Skip to content

Commit

Permalink
Merge pull request #1333 from KoalaSat/update-order-nav-bar-on-time
Browse files Browse the repository at this point in the history
Update order navbar on time
  • Loading branch information
KoalaSat authored Jun 18, 2024
2 parents 62e6258 + 34738e8 commit 10f88e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
8 changes: 5 additions & 3 deletions frontend/src/basic/RobotPage/RobotProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,11 @@ const RobotProfile = ({
};

const handleChangeSlot = (e: SelectChangeEvent<number | 'loading'>): void => {
garage.currentSlot = e.target.value;
setInputToken(garage.getSlot()?.token ?? '');
setLoading(true);
if (e?.target?.value) {
garage.setCurrentSlot(e.target.value as string);
setInputToken(garage.getSlot()?.token ?? '');
setLoading(true);
}
};

const slot = garage.getSlot();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/basic/RobotPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const RobotPage = (): JSX.Element => {
encPrivKey: key.encryptedPrivateKeyArmored,
});
void federation.fetchRobot(garage, token);
garage.currentSlot = token;
garage.setCurrentSlot(token);
})
.catch((error) => {
console.error('Error:', error);
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/models/Garage.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ class Garage {
return slot;
};

setCurrentSlot: (currentSlot: string) => void = (currentSlot) => {
this.currentSlot = currentSlot;
this.triggerHook('onRobotUpdate');
};

// Robots
createRobot: (token: string, shortAliases: string[], attributes: Record<any, any>) => void = (
token,
Expand Down

0 comments on commit 10f88e3

Please sign in to comment.