Skip to content

Commit

Permalink
Fix: Fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
sevenc-nanashi committed Aug 29, 2024
1 parent 9215a5d commit d84b05c
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 29 deletions.
1 change: 1 addition & 0 deletions frontend/app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default async function handleRequest(
},
onError(error: unknown) {
didError = true;
reject(error);
},
},
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useRouteLoaderData,
} from "@remix-run/react";
import clsx from "clsx";
import { useEffect, useMemo, useRef, useState } from "react";
import { useEffect, useMemo, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import favicon from "~/assets/favicon.svg?url";
import DisablePortal from "~/components/DisablePortal";
Expand Down
5 changes: 2 additions & 3 deletions frontend/app/routes/_index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import { ArrowRightFilled, OpenRegular } from "@fluentui/react-icons";
import { type LoaderFunction, type MetaFunction, json } from "@remix-run/node";
import { Link } from "@remix-run/react";
import { pathcat } from "pathcat";
import { useCallback, useEffect, useRef, useState } from "react";
import { useCallback } from "react";
import { Trans, useTranslation } from "react-i18next";
import ChartList from "~/components/ChartList";
import { useServerSettings, useMyFetch } from "~/lib/contexts";
import { useMyFetch, useServerSettings } from "~/lib/contexts";
import { detectLocale, i18n } from "~/lib/i18n.server.ts";
import type { Chart } from "~/lib/types";
import { sonolusUrl } from "~/lib/utils";

export const loader: LoaderFunction = async ({ request }) => {
Expand Down
6 changes: 1 addition & 5 deletions frontend/app/routes/admin.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
type LoaderFunction,
type LoaderFunctionArgs,
json,
} from "@remix-run/node";
import { type LoaderFunctionArgs, json } from "@remix-run/node";
import { Link, type MetaFunction, useNavigate } from "@remix-run/react";
import clsx from "clsx";
import { useCallback, useEffect, useState } from "react";
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/routes/charts._index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as RadixCollapsible from "@radix-ui/react-collapsible";
import { type LoaderFunctionArgs, json } from "@remix-run/node";
import { type MetaFunction, useSearchParams } from "@remix-run/react";
import { pathcat } from "pathcat";
import { useCallback, useMemo, useState } from "react";
import { useCallback, useState } from "react";
import { useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import { WithContext as ReactTags } from "react-tag-input";
Expand Down
3 changes: 1 addition & 2 deletions frontend/app/routes/charts.liked.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { type LoaderFunctionArgs, json } from "@remix-run/node";
import type { MetaFunction } from "@remix-run/react";
import { pathcat } from "pathcat";
import { useCallback, useEffect, useRef, useState } from "react";
import { useCallback } from "react";
import { Trans, useTranslation } from "react-i18next";
import ChartList from "~/components/ChartList.tsx";
import { useMyFetch } from "~/lib/contexts";
import { detectLocale, i18n } from "~/lib/i18n.server.ts";
import requireLogin from "~/lib/requireLogin.tsx";
import type { Chart } from "~/lib/types.ts";

export const loader = async ({ request }: LoaderFunctionArgs) => {
const locale = await detectLocale(request);
Expand Down
3 changes: 1 addition & 2 deletions frontend/app/routes/charts.my.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { type LoaderFunction, json } from "@remix-run/node";
import { Link, type MetaFunction } from "@remix-run/react";
import { pathcat } from "pathcat";
import { useCallback, useEffect, useRef, useState } from "react";
import { useCallback } from "react";
import { Trans, useTranslation } from "react-i18next";
import ChartList from "~/components/ChartList.tsx";
import { useMyFetch } from "~/lib/contexts";
import { detectLocale, i18n } from "~/lib/i18n.server.ts";
import requireLogin from "~/lib/requireLogin.tsx";
import type { Chart } from "~/lib/types.ts";

export const loader: LoaderFunction = async ({ request }) => {
const locale = await detectLocale(request);
Expand Down
2 changes: 0 additions & 2 deletions frontend/app/routes/users.alts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import clsx from "clsx";
import { pathcat } from "pathcat";
import { useCallback, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import DisablePortal from "~/components/DisablePortal.tsx";
import ModalPortal from "~/components/ModalPortal.tsx";
import {
useIsSubmitting,
useMyFetch,
useSession,
useSetIsSubmitting,
useSetServerError,
useSetSession,
} from "~/lib/contexts.ts";
import { detectLocale, i18n } from "~/lib/i18n.server.ts";
Expand Down
1 change: 0 additions & 1 deletion frontend/components/ChartForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
useServerSettings,
useSession,
useSetIsSubmitting,
useSetServerError,
} from "~/lib/contexts";
import type { AdminOnlyUserData, Chart } from "~/lib/types.ts";
import { isAdmin } from "~/lib/utils.ts";
Expand Down
8 changes: 2 additions & 6 deletions frontend/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { NavigationFilled } from "@fluentui/react-icons";
import { Link } from "@remix-run/react";
import { pathcat } from "pathcat";
import { useCallback, useEffect, useRef, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import { useState } from "react";
import LogoCF from "~/assets/logo-cf.svg?react";
import { useSession } from "~/lib/contexts";
import SideMenu from "./SideMenu.tsx";
import { NavigationFilled } from "@fluentui/react-icons";

const Header = () => {
const { t } = useTranslation("header");

const session = useSession();
const [showMenu, setShowMenu] = useState(false);

Expand Down
4 changes: 2 additions & 2 deletions frontend/components/SettingsDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import cookies from "cookie";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import { languageNames } from "~/lib/translations.ts";
import InputTitle from "./InputTitle.tsx";
import Select, { type SelectItems } from "./Select.tsx";
import { useEffect, useState } from "react";
import cookies from "cookie";

type Language = "auto" | keyof typeof languageNames;

Expand Down
8 changes: 4 additions & 4 deletions frontend/components/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import clsx from "clsx";
import i18next from "i18next";
import { createElement, useState } from "react";
import { Trans, useTranslation } from "react-i18next";
import { useLogin } from "~/lib/useLogin.ts";
import { useSession } from "~/lib/contexts.ts";
import { useLogin } from "~/lib/useLogin.ts";
import ModalPortal from "./ModalPortal.tsx";
import SettingsDialog from "./SettingsDialog.tsx";

Expand Down Expand Up @@ -206,7 +206,7 @@ const SideMenu: React.FC<{ close: () => void }> = ({ close }) => {
<div
className={clsx(
"flex items-center bg-theme p-2 bg-opacity-0 hover:bg-opacity-10 transition-colors duration-250 rounded cursor-pointer",
item.className,
"className" in item && item.className,
)}
key={i}
role="button"
Expand All @@ -222,13 +222,13 @@ const SideMenu: React.FC<{ close: () => void }> = ({ close }) => {
</div>
);

if (item.href) {
if ("href" in item && item.href) {
return (
<Link to={item.href} key={i} onClick={close}>
{inner}
</Link>
);
} else if (item.onClick) {
} else if ("onClick" in item) {
return (
<div key={i} onClick={item.onClick}>
{inner}
Expand Down

0 comments on commit d84b05c

Please sign in to comment.