Skip to content

Commit

Permalink
update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
pandanoir committed Nov 4, 2023
1 parent 02965b7 commit 35fa690
Show file tree
Hide file tree
Showing 26 changed files with 2,080 additions and 2,348 deletions.
8 changes: 2 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended"
],
"plugins": [
"@typescript-eslint"
],
"plugins": ["@typescript-eslint"],
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error"
]
"@typescript-eslint/no-unused-vars": ["error"]
}
}
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"singleQuote": true,
"tabWidth": 2
}
}
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ yarn dev
```

[http://localhost:3000](http://localhost:3000) にページが表示される。

2 changes: 1 addition & 1 deletion app/(root)/RecordModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const BestAverages: FC<{ records: TimerRecord[] }> = ({ records }) => {
{Number.isFinite(val)
? `${Math.trunc(val / 1000)}.${`${Math.trunc(val % 1000)}`.padStart(
3,
'0'
'0',
)}`
: 'DNF'}
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion app/(root)/Timer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { useCubeTimer } from './useCubeTimer';

export const usePreventDefault = <T extends HTMLElement>(
eventName: string,
enable = true
enable = true,
) => {
const ref = useRef<T>(null);
useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions app/(root)/TimerPagePresenter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const TimerPagePresenter: FC<
| {
records: TimerRecord[];
createNewRecord: (
record: Omit<TimerRecord, 'id' | 'createdAt'> & { createdAt: number }
record: Omit<TimerRecord, 'id' | 'createdAt'> & { createdAt: number },
) => void;
imposePenalty: (record: TimerRecord) => void;
toDNF: (record: TimerRecord) => void;
Expand Down Expand Up @@ -81,7 +81,7 @@ export const TimerPagePresenter: FC<
}) => {
const [usesInspection, setUsesInspection] = useLocalStorageState(
true,
'usesInspection'
'usesInspection',
);
const {
isOpen: isRecordModalOpen,
Expand Down
15 changes: 9 additions & 6 deletions app/(root)/__snapshots__/page.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
exports[`TimerPage snapshot 1`] = `
<DocumentFragment>
<main
class="chakra-stack css-1wnpsqa"
class="chakra-stack css-118vyam"
>
<div
class="chakra-stack css-84zodg"
class="chakra-stack css-1igwmid"
>
<div
class="chakra-select__wrapper css-dsdwpa"
>
<select
class="chakra-select css-1icl0uu"
class="chakra-select css-9zgf1d"
id="event"
>
<option
Expand Down Expand Up @@ -98,7 +98,7 @@ exports[`TimerPage snapshot 1`] = `
class="carousel"
>
<div
class="chakra-stack css-1d0c3h9"
class="chakra-stack css-10t90fk"
>
<button
aria-label="previous"
Expand Down Expand Up @@ -359,10 +359,13 @@ exports[`TimerPage snapshot 1`] = `
class="css-1rr4qq7"
>
<div
class="chakra-stack css-191yzw1"
class="chakra-stack css-oe35x4"
>
<div
class="chakra-stack css-tl3ftk"
/>
<button
class="chakra-button css-i857na"
class="chakra-button css-ez23ye"
type="button"
>
inspection start
Expand Down
2 changes: 1 addition & 1 deletion app/(root)/page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('TimerPage', () => {
}}
>
<Page />
</UserProvider>
</UserProvider>,
);
await findByRole('button', { name: 'inspection start' });
expect(asFragment()).toMatchSnapshot();
Expand Down
26 changes: 13 additions & 13 deletions app/(root)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const useTimerRecords = (event: string) => {
const { mutate } = useSWRConfig();
const { data, error } = useSWR(
{ url: '/api/record/read', query: { event, limit: '100' } },
fetchRecordPage
fetchRecordPage,
);

if (!data) {
Expand Down Expand Up @@ -56,7 +56,7 @@ const useTimerRecords = (event: string) => {
await res.json(),
...records.slice(index + 1),
],
} satisfies Omit<RecordPage, 'hasNextPage'>)
}) satisfies Omit<RecordPage, 'hasNextPage'>,
),
{
optimisticData: {
Expand All @@ -67,7 +67,7 @@ const useTimerRecords = (event: string) => {
],
} satisfies Omit<RecordPage, 'hasNextPage'>,
rollbackOnError: true,
}
},
);
};
return {
Expand All @@ -82,10 +82,10 @@ const useTimerRecords = (event: string) => {
body: JSON.stringify(record satisfies CreateRequestBody),
}).then(
async (res) =>
({ data: [await res.json(), ...records] } satisfies Omit<
({ data: [await res.json(), ...records] }) satisfies Omit<
RecordPage,
'hasNextPage'
>)
>,
),
{
optimisticData: {
Expand All @@ -99,7 +99,7 @@ const useTimerRecords = (event: string) => {
],
} satisfies Omit<RecordPage, 'hasNextPage'>,
rollbackOnError: true,
}
},
);
},
imposePenalty: ({ id, time, scramble }: TimerRecord) => {
Expand Down Expand Up @@ -143,20 +143,20 @@ const useTimerRecords = (event: string) => {
? { id }
: {
compositeKey: { time, scramble },
}) satisfies DeleteRequestBody
}) satisfies DeleteRequestBody,
),
}).then(
() =>
({
data: [...records.slice(0, index), ...records.slice(index + 1)],
} satisfies Omit<RecordPage, 'hasNextPage'>)
}) satisfies Omit<RecordPage, 'hasNextPage'>,
),
{
optimisticData: {
data: [...records.slice(0, index), ...records.slice(index + 1)],
} satisfies Omit<RecordPage, 'hasNextPage'>,
rollbackOnError: true,
}
},
);
},

Expand All @@ -169,17 +169,17 @@ const useTimerRecords = (event: string) => {
body: JSON.stringify(record),
}).then(
async (res) =>
({ data: [await res.json(), ...records] } satisfies Omit<
({ data: [await res.json(), ...records] }) satisfies Omit<
RecordPage,
'hasNextPage'
>)
>,
),
{
optimisticData: {
data: [{ ...record, id: tempId }, ...records],
} satisfies Omit<RecordPage, 'hasNextPage'>,
rollbackOnError: true,
}
},
);
},
} as const;
Expand All @@ -201,7 +201,7 @@ const TimerPage: FC = () => {
const { isLoading, user } = useUser();
const [currentEvent, setCurrentEvent] = useLocalStorageState(
'3x3x3',
'currentEvent'
'currentEvent',
);
const scrambleHistory = useScrambleHistory(currentEvent);

Expand Down
4 changes: 2 additions & 2 deletions app/(root)/useCubeTimer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const useCubeTimer = ({
onStop(elapsedTime, inspectionTime);
setInspectionTime(null);
},
[onStop, inspectionTime]
[onStop, inspectionTime],
),
});
const { start: startStopwatch } = stopwatch;
Expand All @@ -62,7 +62,7 @@ export const useCubeTimer = ({
setInspectionTime(elapsedTime);
startStopwatch?.();
},
[startStopwatch]
[startStopwatch],
),
});

Expand Down
2 changes: 1 addition & 1 deletion app/(root)/useScrambleHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const useScrambleHistory = (currentEvent: string) => {
}, 100);
});
},
[scrambleHistory.length, scrambler]
[scrambleHistory.length, scrambler],
);
return {
scrambleHistory,
Expand Down
2 changes: 1 addition & 1 deletion app/SWRConfigClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const SWRConfigClient = ({
keyValues?.flatMap(([k, v]) => [
[unstable_serialize(k), v],
[`$inf$${unstable_serialize(k)}`, [v]],
]) ?? []
]) ?? [],
),
},
}}
Expand Down
2 changes: 1 addition & 1 deletion app/_utils/appendSearchParamsByEntries.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const appendSearchParamsByEntries = (
url: URL,
entries: [string, unknown][]
entries: [string, unknown][],
) => {
for (const [k, v] of entries) {
if (typeof v !== 'string') {
Expand Down
8 changes: 4 additions & 4 deletions app/_utils/calcAo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ describe('calcAo', () => {
scramble: '',
id: '',
event: '',
}))
)
})),
),
).toEqual(370);
});

Expand Down Expand Up @@ -47,7 +47,7 @@ describe('calcAo', () => {
id: '',
event: '',
},
])
]),
).toBe(100);
});

Expand Down Expand Up @@ -81,7 +81,7 @@ describe('calcAo', () => {
id: '',
event: '',
},
])
]),
).toBe(Infinity);
});
});
12 changes: 6 additions & 6 deletions app/_utils/calcRollingAverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('calcRa', () => {
id: '',
event: '',
})),
5
)
5,
),
).toEqual([null, null, null, null, 370]);

expect(
Expand All @@ -31,8 +31,8 @@ describe('calcRa', () => {
id: '',
event: '',
})),
25
)
25,
),
).toEqual([
null,
null,
Expand Down Expand Up @@ -74,8 +74,8 @@ describe('calcRa', () => {
id: '',
event: '',
})),
6
)
6,
),
).toEqual([null, null, null, null, null]);
});
});
6 changes: 3 additions & 3 deletions app/_utils/fetchRecordPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ const validate = $object({
id: $string,
event: $string,
},
false
)
false,
),
),
hasNextPage: $boolean,
});

export const fetchRecordPage = async (key: {
url: string;
query: { event: string; limit: string; cursor: string | undefined };
query: { event: string; limit: string; cursor?: string | undefined };
}) => {
const url = new URL(key.url, location.origin);
appendSearchParamsByEntries(url, Object.entries(key.query));
Expand Down
4 changes: 2 additions & 2 deletions app/anonymous/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const useTimerRecords = (event: string) => {
records,
error: undefined,
createNewRecord: (
record: Omit<TimerRecord, 'id' | 'createdAt'> & { createdAt: number }
record: Omit<TimerRecord, 'id' | 'createdAt'> & { createdAt: number },
) => {
setAllRecords((allRecords) => {
const records = allRecords[event];
Expand Down Expand Up @@ -98,7 +98,7 @@ const useTimerRecords = (event: string) => {
const TimerPage: FC = () => {
const [currentEvent, setCurrentEvent] = useLocalStorageState(
'3x3x3',
'currentEvent'
'currentEvent',
);

return (
Expand Down
4 changes: 2 additions & 2 deletions app/api/record/update/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const validate = $intersection([
scramble: $union([$string, $undefined]),
event: $union([$string, $undefined]),
},
false
false,
),
$union([
$object({ id: $string }, false),
$object(
{ compositeKey: $object({ time: $number, scramble: $string }) },
false
false,
),
]),
]);
Expand Down
4 changes: 2 additions & 2 deletions app/records/[[...type]]/DailyAverageGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const useDailyAverageInfinite = (event: string) => {
},
} satisfies Parameters<typeof fetchRecordPage>[0];
},
fetchRecordPage
fetchRecordPage,
);
const records = data?.map(({ data }) => data);

Expand Down Expand Up @@ -82,7 +82,7 @@ const DailyAverageGraph: FC<{ event: string }> = ({ event }) => {
y: averageMillisec / 1000,
}))
: [],
[averages]
[averages],
);
const cardBg = useColorModeValue('gray.50', 'gray.700');
const textColor = useColorModeValue('black', 'white');
Expand Down
Loading

1 comment on commit 35fa690

@vercel
Copy link

@vercel vercel bot commented on 35fa690 Nov 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hi-timer – ./

hi-timer-git-main-pandanoir.vercel.app
hi-timer.vercel.app
hi-timer-pandanoir.vercel.app

Please sign in to comment.