Skip to content

Commit

Permalink
cleanup build after importing P-man's changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sphinxrave committed Oct 23, 2023
1 parent 42284e3 commit 821f106
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 5,564 deletions.
5 changes: 4 additions & 1 deletion packages/react/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"$schema": "http://json.schemastore.org/prettierrc",
"tabWidth": 2,
"semi": true,
"singleQuote": false,
"trailingComma": "all",
"printWidth": 80,
"useTabs": false,
"endOfLine": "auto"
"endOfLine": "auto",
"curly": true,
"arrowParens": "always"
}
5,535 changes: 2 additions & 5,533 deletions packages/react/package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"clsx": "^2.0.0",
"cmdk": "^0.2.0",
"css-vars-hook": "^0.6.18",
"date-fns": "^2.30.0",
"dayjs": "^1.11.10",
"i18next": "^23.6.0",
"i18next-browser-languagedetector": "^7.1.0",
Expand Down Expand Up @@ -105,4 +104,4 @@
"unocss-preset-autoprefixer": "^0.0.6",
"vite": "^4.5.0"
}
}
}
12 changes: 6 additions & 6 deletions packages/react/src/components/about/request/AddSubber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function AddSubberForm() {
const form = useForm({
defaultValues: formValues,
});
const { mutate, isLoading } = useReportMutation(
const { mutate, isPending } = useReportMutation(
{ type: "channel" },
{
onSuccess: () => {
Expand Down Expand Up @@ -154,9 +154,9 @@ export function AddSubberForm() {
{...field}
{...form.register("link", {
required: {
value: true,
message: t("channelRequest.required")
},
value: true,
message: t("channelRequest.required"),
},
pattern: {
value:
/(?:https?:\/\/)(?:www\.)?youtu(?:be\.com\/)(?:channel)\/([\w\-_]*)/gi,
Expand Down Expand Up @@ -228,10 +228,10 @@ export function AddSubberForm() {
</FormItem>
)}
/>
<Button disabled={isLoading} type="submit" className="w-full">
<Button disabled={isPending} type="submit" className="w-full">
<div
className={
isLoading ? "i-lucide:loader-2 animate-spin" : "i-heroicons:check"
isPending ? "i-lucide:loader-2 animate-spin" : "i-heroicons:check"
}
/>
{t("channelRequest.sendRequest")}
Expand Down
20 changes: 12 additions & 8 deletions packages/react/src/components/about/request/AddVtuber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const formValues = {
};

export function AddVtuberForm() {
const navigate = useNavigate();
const navigate = useNavigate();
const { toast } = useToast();
const { t } = useTranslation();
const form = useForm({
defaultValues: formValues,
});
const { mutate, isLoading } = useReportMutation(
const { mutate, isPending } = useReportMutation(
{ type: "channel" },
{
onSuccess: () => {
Expand Down Expand Up @@ -68,7 +68,7 @@ export function AddVtuberForm() {
const id = matches?.[0]?.[1];

const res = await fetch(`/api/v2/channels/${id}`);
if (res.ok && (await res.json()).id) return navigate(`/channel/${id}`);
if (res.ok && (await res.json()).id) return navigate(`/channel/${id}`);

mutate({
content: "Look what the cat dragged in...",
Expand Down Expand Up @@ -164,9 +164,9 @@ export function AddVtuberForm() {
{...field}
{...form.register("link", {
required: {
value: true,
message: t("channelRequest.required")
},
value: true,
message: t("channelRequest.required"),
},
pattern: {
value:
/(?:https?:\/\/)(?:www\.)?youtu(?:be\.com\/)(?:channel)\/([\w\-_]*)/gi,
Expand Down Expand Up @@ -270,8 +270,12 @@ export function AddVtuberForm() {
</FormItem>
)}
/>
<Button disabled={isLoading} type="submit" className="w-full">
<div className={isLoading ? 'i-lucide:loader-2 animate-spin' : "i-heroicons:check"} />
<Button disabled={isPending} type="submit" className="w-full">
<div
className={
isPending ? "i-lucide:loader-2 animate-spin" : "i-heroicons:check"
}
/>
{t("channelRequest.sendRequest")}
</Button>
</form>
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/about/request/DeleteChannel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function DeleteChannelForm() {
const form = useForm({
defaultValues: formValues,
});
const { mutate, isLoading } = useReportMutation(
const { mutate, isPending } = useReportMutation(
{ type: "channel" },
{
onSuccess: () => {
Expand Down Expand Up @@ -171,10 +171,10 @@ export function DeleteChannelForm() {
</FormItem>
)}
/>
<Button disabled={isLoading} type="submit" className="w-full">
<Button disabled={isPending} type="submit" className="w-full">
<div
className={
isLoading ? "i-lucide:loader-2 animate-spin" : "i-heroicons:check"
isPending ? "i-lucide:loader-2 animate-spin" : "i-heroicons:check"
}
/>
{t("channelRequest.sendRequest")}
Expand Down
6 changes: 3 additions & 3 deletions packages/react/src/components/about/request/ModifyInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function ModifyInfoForm() {
const form = useForm({
defaultValues: formValues,
});
const { mutate, isLoading } = useReportMutation(
const { mutate, isPending } = useReportMutation(
{ type: "channel" },
{
onSuccess: () => {
Expand Down Expand Up @@ -225,10 +225,10 @@ export function ModifyInfoForm() {
</FormItem>
)}
/>
<Button disabled={isLoading} type="submit" className="w-full">
<Button disabled={isPending} type="submit" className="w-full">
<div
className={
isLoading ? "i-lucide:loader-2 animate-spin" : "i-heroicons:check"
isPending ? "i-lucide:loader-2 animate-spin" : "i-heroicons:check"
}
/>
{t("channelRequest.sendRequest")}
Expand Down
3 changes: 1 addition & 2 deletions packages/react/src/components/channel/ChannelCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export function ChannelCard({
clip_count,
top_topics,
twitter,
twitch,
inactive,
twitch, // inactive,
}: ChannelCardProps) {
const { t } = useTranslation();
const { mutate, isPending: mutateLoading } = useFavoriteMutation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function useServerAutocomplete(
return useQuery({
queryKey: ["autocomplete", searchCategory, searchString],
queryFn: async (
ctx,
_,
): Promise<Record<"vtuber" | "topic" | "org", QueryItem[]>> => {
if (
!searchCategory ||
Expand Down
8 changes: 3 additions & 5 deletions packages/react/src/lib/atomWithDebounce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ export default function atomWithDebounce<T>(
delayMilliseconds = 500,
shouldDebounceOnReset = false,
) {
const prevTimeoutAtom = atom<ReturnType<typeof setTimeout> | undefined>(
undefined,
);
const prevTimeoutAtom = atom<number | NodeJS.Timeout | undefined>(undefined);

// DO NOT EXPORT currentValueAtom as using this atom to set state can cause
// inconsistent state between currentValueAtom and debouncedValueAtom
Expand All @@ -17,7 +15,7 @@ export default function atomWithDebounce<T>(
const debouncedValueAtom = atom(
initialValue,
(get, set, update: SetStateAction<T>) => {
clearTimeout(get(prevTimeoutAtom));
clearTimeout(get(prevTimeoutAtom) as number);

const prevValue = get(_currentValueAtom);
const nextValue =
Expand Down Expand Up @@ -53,7 +51,7 @@ export default function atomWithDebounce<T>(

// exported atom setter to clear timeout if needed
const clearTimeoutAtom = atom(null, (get, set, _arg) => {
clearTimeout(get(prevTimeoutAtom));
clearTimeout(get(prevTimeoutAtom) as number);
set(isDebouncingAtom, false);
});

Expand Down

0 comments on commit 821f106

Please sign in to comment.