Skip to content

Commit

Permalink
Merge pull request #759 from isucon/fix-ui5
Browse files Browse the repository at this point in the history
[FE] 細部修正
  • Loading branch information
imamiya-masaki authored Dec 7, 2024
2 parents add0be7 + be60a4b commit 71fada5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"typescript.tsdk": "./node_modules/typescript/lib",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.organizeImports": "always"
Expand All @@ -7,6 +8,9 @@
"[go]": {
"editor.defaultFormatter": "golang.go"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
Expand Down
18 changes: 9 additions & 9 deletions frontend/app/components/hooks/use-emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ const move = (
}
};

const currentCoodinatePost = async (coordinate: Coordinate) => {
const currentCoodinatePost = (coordinate: Coordinate) => {
setSimulatorCurrentCoordinate(coordinate);
void (await fetchChairPostCoordinate({
return fetchChairPostCoordinate({
body: coordinate,
}));
});
};

const postEnroute = (rideId: string, coordinate: Coordinate) => {
setSimulatorStartCoordinate(coordinate);
void fetchChairPostRideStatus({
return fetchChairPostRideStatus({
body: { status: "ENROUTE" },
pathParams: {
rideId,
Expand All @@ -55,7 +55,7 @@ const postEnroute = (rideId: string, coordinate: Coordinate) => {
};

const postCarring = (rideId: string) => {
void fetchChairPostRideStatus({
return fetchChairPostRideStatus({
body: { status: "CARRYING" },
pathParams: {
rideId,
Expand All @@ -72,8 +72,8 @@ const forceCarry = (pickup_coordinate: Coordinate, rideId: RideId) =>
setTimeout(() => {
try {
void (async () => {
void (await currentCoodinatePost(pickup_coordinate));
postCarring(rideId);
await currentCoodinatePost(pickup_coordinate);
void postCarring(rideId);
})();
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -136,10 +136,10 @@ export const useEmulator = () => {
try {
switch (data.status) {
case "MATCHING":
postEnroute(data.ride_id, chair.coordinate);
void postEnroute(data.ride_id, chair.coordinate);
break;
case "PICKUP":
postCarring(data.ride_id);
void postCarring(data.ride_id);
break;
case "ENROUTE":
setCoordinate?.(move(chair.coordinate, data.pickup_coordinate));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const ChairInformation: FC<
<Text tagName="span" className="pr-1">
評価:
</Text>
{chair.stats?.total_evaluation_avg}
{chair.stats.total_evaluation_avg.toFixed(1)}
</Text>
)}
{chair.stats?.total_rides_count && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ const ChairProgress: FC<{
<div className="w-full me-6">
{rideStatus &&
["MATCHING", "COMPLETED", "ENROUTE"].includes(rideStatus) && (
<div style={{ transform: `translateX(${progressToPickup}%)` }}>
<div
className="transition-transform duration-300"
style={{ transform: `translateX(${progressToPickup}%)` }}
>
<div
className={twMerge(
rideStatus === "ENROUTE" && "animate-shake",
Expand All @@ -97,6 +100,7 @@ const ChairProgress: FC<{
{rideStatus &&
["PICKUP", "CARRYING", "ARRIVED"].includes(rideStatus) && (
<div
className="transition-transform duration-300"
style={{ transform: `translateX(${progressToDestination}%)` }}
>
<div
Expand Down

0 comments on commit 71fada5

Please sign in to comment.