Merge pull request #1333 from KoalaSat/update-order-nav-bar-on-time

Update order navbar on time
This commit is contained in:
KoalaSat 2024-06-18 12:46:24 +00:00 committed by GitHub
commit 10f88e3b5d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 4 deletions

View File

@ -67,9 +67,11 @@ const RobotProfile = ({
}; };
const handleChangeSlot = (e: SelectChangeEvent<number | 'loading'>): void => { const handleChangeSlot = (e: SelectChangeEvent<number | 'loading'>): void => {
garage.currentSlot = e.target.value; if (e?.target?.value) {
setInputToken(garage.getSlot()?.token ?? ''); garage.setCurrentSlot(e.target.value as string);
setLoading(true); setInputToken(garage.getSlot()?.token ?? '');
setLoading(true);
}
}; };
const slot = garage.getSlot(); const slot = garage.getSlot();

View File

@ -71,7 +71,7 @@ const RobotPage = (): JSX.Element => {
encPrivKey: key.encryptedPrivateKeyArmored, encPrivKey: key.encryptedPrivateKeyArmored,
}); });
void federation.fetchRobot(garage, token); void federation.fetchRobot(garage, token);
garage.currentSlot = token; garage.setCurrentSlot(token);
}) })
.catch((error) => { .catch((error) => {
console.error('Error:', error); console.error('Error:', error);

View File

@ -106,6 +106,11 @@ class Garage {
return slot; return slot;
}; };
setCurrentSlot: (currentSlot: string) => void = (currentSlot) => {
this.currentSlot = currentSlot;
this.triggerHook('onRobotUpdate');
};
// Robots // Robots
createRobot: (token: string, shortAliases: string[], attributes: Record<any, any>) => void = ( createRobot: (token: string, shortAliases: string[], attributes: Record<any, any>) => void = (
token, token,