Skip to content

Commit

Permalink
Merge branch 'main' into fix-simulator-code
Browse files Browse the repository at this point in the history
# Conflicts:
#	frontend/app/components/modules/simulator-display/simulator-chair-display.tsx
#	frontend/app/routes/simulator._index/route.tsx
  • Loading branch information
narirou committed Dec 4, 2024
2 parents b58bc15 + 379b45b commit 242eef0
Show file tree
Hide file tree
Showing 56 changed files with 271 additions and 653 deletions.
2 changes: 1 addition & 1 deletion bench/benchmarker/webapp/api/generate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package api

//go:generate go run github.com/ogen-go/ogen/cmd/ogen --target . --clean ../../../../openapi/openapi.yaml
//go:generate go run github.com/ogen-go/ogen/cmd/ogen --target . --clean ../../../../webapp/openapi.yaml
46 changes: 44 additions & 2 deletions bench/benchmarker/webapp/api/oas_client_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions bench/benchmarker/webapp/api/oas_json_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions bench/benchmarker/webapp/api/oas_response_decoders_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 5 additions & 11 deletions bench/benchmarker/webapp/api/oas_schemas_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions bench/benchmarker/webapp/api/oas_validators_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion development/dockerfiles/Dockerfile.rust
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.82-bookworm
FROM rust:1.83-bookworm

WORKDIR /home/isucon/webapp/rust

Expand Down
2 changes: 1 addition & 1 deletion frontend/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
commonjs: true,
es6: true,
},
ignorePatterns: ["!**/.server", "!**/.client", "app/apiClient/"],
ignorePatterns: ["!**/.server", "!**/.client", "app/api/"],
extends: ["eslint:recommended"],
overrides: [
// React
Expand Down
2 changes: 1 addition & 1 deletion frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
app/apiClient/
app/api/
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
* @version 1.0
*/
import * as reactQuery from "@tanstack/react-query";
import { useApiContext, ApiContext } from "./apiContext";
import type * as Fetcher from "./apiFetcher";
import { apiFetch } from "./apiFetcher";
import type * as Schemas from "./apiSchemas";
import { useApiContext, ApiContext } from "./api-context";
import type * as Fetcher from "./api-fetcher";
import { apiFetch } from "./api-fetcher";
import type * as Schemas from "./api-schemas";

export type PostInitializeError = Fetcher.ErrorWrapper<undefined>;

Expand Down Expand Up @@ -610,6 +610,9 @@ export type AppGetNearbyChairsVariables = {
queryParams: AppGetNearbyChairsQueryParams;
} & ApiContext["fetcherOptions"];

/**
* 椅子からサーバーに記録された座標情報は3秒以内に反映されている必要があります。
*/
export const fetchAppGetNearbyChairs = (
variables: AppGetNearbyChairsVariables,
signal?: AbortSignal,
Expand All @@ -623,6 +626,9 @@ export const fetchAppGetNearbyChairs = (
{}
>({ url: "/app/nearby-chairs", method: "get", ...variables, signal });

/**
* 椅子からサーバーに記録された座標情報は3秒以内に反映されている必要があります。
*/
export const useAppGetNearbyChairs = <TData = AppGetNearbyChairsResponse,>(
variables: AppGetNearbyChairsVariables,
options?: Omit<
Expand Down Expand Up @@ -1182,6 +1188,42 @@ export const useChairPostRideStatus = (
});
};

export type InternalGetMatchingError = Fetcher.ErrorWrapper<undefined>;

export type InternalGetMatchingVariables = ApiContext["fetcherOptions"];

export const fetchInternalGetMatching = (
variables: InternalGetMatchingVariables,
signal?: AbortSignal,
) =>
apiFetch<undefined, InternalGetMatchingError, undefined, {}, {}, {}>({
url: "/internal/matching",
method: "get",
...variables,
signal,
});

export const useInternalGetMatching = <TData = undefined,>(
variables: InternalGetMatchingVariables,
options?: Omit<
reactQuery.UseQueryOptions<undefined, InternalGetMatchingError, TData>,
"queryKey" | "queryFn" | "initialData"
>,
) => {
const { fetcherOptions, queryOptions, queryKeyFn } = useApiContext(options);
return reactQuery.useQuery<undefined, InternalGetMatchingError, TData>({
queryKey: queryKeyFn({
path: "/internal/matching",
operationId: "internalGetMatching",
variables,
}),
queryFn: ({ signal }) =>
fetchInternalGetMatching({ ...fetcherOptions, ...variables }, signal),
...options,
...queryOptions,
});
};

export type QueryOperation =
| {
path: "/app/rides";
Expand Down Expand Up @@ -1212,4 +1254,9 @@ export type QueryOperation =
path: "/chair/notification";
operationId: "chairGetNotification";
variables: ChairGetNotificationVariables;
}
| {
path: "/internal/matching";
operationId: "internalGetMatching";
variables: InternalGetMatchingVariables;
};
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { QueryKey, UseQueryOptions } from "@tanstack/react-query";
import { QueryOperation } from "./apiComponents";
import { QueryOperation } from "./api-components";

export type ApiContext = {
fetcherOptions: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApiContext } from "./apiContext";
import { ApiContext } from "./api-context";

const baseUrl = __API_BASE_URL__;

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions frontend/app/components/hooks/use-emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { useEffect } from "react";
import {
fetchChairPostCoordinate,
fetchChairPostRideStatus,
} from "~/apiClient/apiComponents";
import { Coordinate } from "~/apiClient/apiSchemas";
} from "~/api/api-components";
import { Coordinate } from "~/api/api-schemas";
import type { SimulatorChair } from "~/types";
import {
setSimulatorCurrentCoordinate,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ComponentProps, FC } from "react";
import { twMerge } from "tailwind-merge";
import { Coordinate } from "~/apiClient/apiSchemas";
import { Coordinate } from "~/api/api-schemas";
import { PinIcon } from "~/components/icon/pin";
import { Button } from "~/components/primitives/button/button";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentProps, FC } from "react";
import { twMerge } from "tailwind-merge";
import { RideStatus } from "~/apiClient/apiSchemas";
import { RideStatus } from "~/api/api-schemas";
import { Text } from "~/components/primitives/text/text";

const StatusList = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FC, memo, useCallback, useMemo, useRef, useState } from "react";
import { twMerge } from "tailwind-merge";
import colors from "tailwindcss/colors";
import { RideStatus } from "~/apiClient/apiSchemas";
import { RideStatus } from "~/api/api-schemas";
import { ChairIcon } from "~/components/icon/chair";
import { PinIcon } from "~/components/icon/pin";
import { LocationButton } from "~/components/modules/location-button/location-button";
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/contexts/owner-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
OwnerGetSalesResponse,
fetchOwnerGetChairs,
fetchOwnerGetSales,
} from "~/apiClient/apiComponents";
} from "~/api/api-components";
import { isClientApiError } from "~/types";
import { getCookieValue } from "~/utils/get-cookie-value";

Expand Down
6 changes: 3 additions & 3 deletions frontend/app/contexts/simulator-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import {
useMemo,
useState,
} from "react";
import type { Coordinate } from "~/apiClient/apiSchemas";
import type { Coordinate } from "~/api/api-schemas";
import { getSimulateChair } from "~/utils/get-initial-data";

import { apiBaseURL } from "~/apiClient/APIBaseURL";
import { apiBaseURL } from "~/api/api-base-url";
import {
ChairGetNotificationResponse,
fetchChairGetNotification,
} from "~/apiClient/apiComponents";
} from "~/api/api-components";
import type { ClientChairRide, SimulatorChair } from "~/types";
import { getSimulatorCurrentCoordinate } from "~/utils/storage";

Expand Down
6 changes: 3 additions & 3 deletions frontend/app/contexts/user-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
useState,
type ReactNode,
} from "react";
import { apiBaseURL } from "~/apiClient/APIBaseURL";
import { apiBaseURL } from "~/api/api-base-url";
import {
AppGetNotificationResponse,
fetchAppGetNotification,
} from "~/apiClient/apiComponents";
import type { Coordinate, RideStatus } from "~/apiClient/apiSchemas";
} from "~/api/api-components";
import type { Coordinate, RideStatus } from "~/api/api-schemas";
import { isClientApiError, type ClientAppRide } from "~/types";
import { getCookieValue } from "~/utils/get-cookie-value";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Form } from "@remix-run/react";
import { MouseEventHandler, useCallback, useEffect, useState } from "react";
import colors from "tailwindcss/colors";
import { fetchAppPostRideEvaluation } from "~/apiClient/apiComponents";
import { fetchAppPostRideEvaluation } from "~/api/api-components";
import { PinIcon } from "~/components/icon/pin";
import { Price } from "~/components/modules/price/price";
import { Button } from "~/components/primitives/button/button";
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/routes/client._index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
fetchAppGetNearbyChairs,
fetchAppPostRides,
fetchAppPostRidesEstimatedFare,
} from "~/apiClient/apiComponents";
import { Coordinate, RideStatus } from "~/apiClient/apiSchemas";
} from "~/api/api-components";
import { Coordinate, RideStatus } from "~/api/api-schemas";
import { useGhostChairs } from "~/components/hooks/use-ghost-chairs";
import { CampaignBanner } from "~/components/modules/campaign-banner/campaign-banner";
import { LocationButton } from "~/components/modules/location-button/location-button";
Expand Down
Loading

0 comments on commit 242eef0

Please sign in to comment.