Skip to content

Commit

Permalink
biomeの変更 + format
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-20 committed Jan 13, 2024
1 parent 4bebf2d commit 1117cbc
Show file tree
Hide file tree
Showing 21 changed files with 391 additions and 842 deletions.
2 changes: 1 addition & 1 deletion .code-workspace
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
Expand Down
27 changes: 25 additions & 2 deletions apps/web/biome.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,36 @@
{
"$schema": "https://biomejs.dev/schemas/1.4.0/schema.json",
"extends": ["../../biome.json"],
"files": {
"ignore": ["./lib.dom.d.ts", "./src/shared/lib/$path.ts"]
},
"organizeImports": {
"enabled": false
},
"linter": {
"enabled": false
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"lineEnding": "lf"
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double",
"semicolons": "always",
"trailingComma": "all"
}
},
"json": {
"parser": { "allowComments": true, "allowTrailingCommas": true }
},
"vcs": {
"root": "../../"
"clientKind": "git",
"enabled": true,
"root": "../../",
"useIgnoreFile": true
}
}
34 changes: 17 additions & 17 deletions apps/web/src/client/Auth/Login.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { AuthWithGoogleButton } from "@/client/Auth/_components/AuthWithGoogleButton";
import { useAutoRedirectIfLoggedIn } from "@/features/supabase/auth";
import { Stack } from "@mantine/core";
import type { FC } from "react";
import { AuthHeading } from "./_components/AuthHeading";
import { AuthLayout } from "./_components/AuthLayout";
import { AuthWithGitHubButton } from "./_components/AuthWithGitHubButton";
import { AuthWithGoogleButton } from '@/client/Auth/_components/AuthWithGoogleButton';
import { useAutoRedirectIfLoggedIn } from '@/features/supabase/auth';
import { Stack } from '@mantine/core';
import type { FC } from 'react';
import { AuthHeading } from './_components/AuthHeading';
import { AuthLayout } from './_components/AuthLayout';
import { AuthWithGitHubButton } from './_components/AuthWithGitHubButton';

export const Login: FC = () => {
useAutoRedirectIfLoggedIn("/home");
useAutoRedirectIfLoggedIn('/home');

return (
<AuthLayout>
<AuthHeading>ログイン</AuthHeading>
<Stack spacing={16}>
<AuthWithGitHubButton />
<AuthWithGoogleButton />
</Stack>
</AuthLayout>
);
return (
<AuthLayout>
<AuthHeading>ログイン</AuthHeading>
<Stack spacing={16}>
<AuthWithGitHubButton />
<AuthWithGoogleButton />
</Stack>
</AuthLayout>
);
};
36 changes: 18 additions & 18 deletions apps/web/src/client/Auth/_components/AuthWithGitHubButton.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { useSupabase } from "@/features/supabase/supabaseClient";
import { css } from "@emotion/react";
import { Button } from "@mantine/core";
import { IconBrandGithubFilled } from "@tabler/icons-react";
import type { FC } from "react";
import { useSupabase } from '@/features/supabase/supabaseClient';
import { css } from '@emotion/react';
import { Button } from '@mantine/core';
import { IconBrandGithubFilled } from '@tabler/icons-react';
import type { FC } from 'react';

export const AuthWithGitHubButton: FC = () => {
const { loginWithGitHub } = useSupabase();
const { loginWithGitHub } = useSupabase();

return (
<Button
css={css`
return (
<Button
css={css`
background-color: black;
&:hover {
background-color: #222;
}
`}
// アイコンが微妙に満足できない
leftIcon={<IconBrandGithubFilled />}
onClick={loginWithGitHub}
type="button"
variant="filled"
>
GitHubで認証
</Button>
);
// アイコンが微妙に満足できない
leftIcon={<IconBrandGithubFilled />}
onClick={loginWithGitHub}
type="button"
variant="filled"
>
GitHubで認証
</Button>
);
};
36 changes: 18 additions & 18 deletions apps/web/src/client/Auth/_components/AuthWithGoogleButton.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useSupabase } from "@/features/supabase/supabaseClient";
import { css } from "@emotion/react";
import { Button } from "@mantine/core";
import Image from "next/image";
import type { FC } from "react";
import GoogleIcon from "~/public/assets/google-icon.png";
import { useSupabase } from '@/features/supabase/supabaseClient';
import { css } from '@emotion/react';
import { Button } from '@mantine/core';
import Image from 'next/image';
import type { FC } from 'react';
import GoogleIcon from '~/public/assets/google-icon.png';

export const AuthWithGoogleButton: FC = () => {
const { loginWithGoogle } = useSupabase();
const { loginWithGoogle } = useSupabase();

return (
<Button
css={css`
return (
<Button
css={css`
border: 1px solid #aaa;
background-color: white;
color: inherit;
Expand All @@ -19,12 +19,12 @@ export const AuthWithGoogleButton: FC = () => {
background-color: #eee;
}
`}
leftIcon={<Image alt="" height={24} src={GoogleIcon} width={24} />}
onClick={loginWithGoogle}
type="button"
variant="outline"
>
Googleで認証
</Button>
);
leftIcon={<Image alt="" height={24} src={GoogleIcon} width={24} />}
onClick={loginWithGoogle}
type="button"
variant="outline"
>
Googleで認証
</Button>
);
};
14 changes: 6 additions & 8 deletions apps/web/src/client/Home/_components/UnreadClips/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Center, Loader } from '@mantine/core';
import { useIntersection } from '@mantine/hooks';
import type { ReactNode, FC } from 'react';
import { useEffect } from 'react';
import { NoContent } from '@/client/Home/_components/UnreadClips/NoContent';
import { UnreadClipPanels } from '@/client/Home/_components/UnreadClips/UnreadClipPanels';
import { useUserClips } from '@/client/_components/hooks/useUserClips';
import { Center, Loader } from '@mantine/core';
import { useIntersection } from '@mantine/hooks';
import type { FC, ReactNode } from 'react';
import { useEffect } from 'react';
import { UnreadClipList } from './UnreadClipList';

export type UnreadClipViewType = 'panel' | 'list';
Expand All @@ -24,10 +24,8 @@ export const UnreadClips: FC<UnreadClipsProps> = ({ type, includeRead }) => {
});

useEffect(() => {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- nullのときがある
if (entry === null) return;

if (entry.isIntersecting) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- entryがnullのときがある
if (entry?.isIntersecting) {
void loadNext();
}
}, [entry, loadNext]);
Expand Down
122 changes: 61 additions & 61 deletions apps/web/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
import { fetcher } from "@/features/swr/fetcher";
import { GoogleTagManagerBody } from "@/shared/components/GoogleTagManager";
import "@/shared/styles/global.css";
import { MantineProvider } from "@mantine/core";
import { createPagesBrowserClient } from "@supabase/auth-helpers-nextjs";
import type { Session } from "@supabase/auth-helpers-react";
import { SessionContextProvider } from "@supabase/auth-helpers-react";
import type { AppProps } from "next/app";
import localFont from "next/font/local";
import { useMemo } from "react";
import "ress";
import { SWRConfig } from "swr";
import { fetcher } from '@/features/swr/fetcher';
import { GoogleTagManagerBody } from '@/shared/components/GoogleTagManager';
import '@/shared/styles/global.css';
import { MantineProvider } from '@mantine/core';
import { createPagesBrowserClient } from '@supabase/auth-helpers-nextjs';
import type { Session } from '@supabase/auth-helpers-react';
import { SessionContextProvider } from '@supabase/auth-helpers-react';
import type { AppProps } from 'next/app';
import localFont from 'next/font/local';
import { useMemo } from 'react';
import 'ress';
import { SWRConfig } from 'swr';

const font = localFont({
src: "./NotoSansJP-VariableFont_wght.ttf",
preload: true,
src: './NotoSansJP-VariableFont_wght.ttf',
preload: true,
});

const authCookieName = process.env.NEXT_PUBLIC_SUPABASE_AUTH_COOKIE_NAME;

const MyApp = ({
Component,
pageProps,
Component,
pageProps,
}: AppProps<{ initialSession: Session }>) => {
const supabaseClient = useMemo(
() =>
createPagesBrowserClient({
cookieOptions: authCookieName
? {
name: authCookieName,
secure: true,
sameSite: "Lax",
domain: "",
path: "/",
}
: undefined,
}),
[],
);
const supabaseClient = useMemo(
() =>
createPagesBrowserClient({
cookieOptions: authCookieName
? {
name: authCookieName,
secure: true,
sameSite: 'Lax',
domain: '',
path: '/',
}
: undefined,
}),
[],
);

return (
<>
<GoogleTagManagerBody />
<MantineProvider
theme={{
/** Put your mantine theme override here */
colorScheme: "light",
breakpoints: {
xs: "360px",
sm: "540px",
md: "720px",
lg: "1080px",
xl: "1200px",
},
fontFamily: font.style.fontFamily,
}}
withGlobalStyles
withNormalizeCSS
>
<SessionContextProvider
initialSession={pageProps.initialSession}
supabaseClient={supabaseClient}
>
<SWRConfig value={{ fetcher }}>
<Component {...pageProps} />
</SWRConfig>
</SessionContextProvider>
</MantineProvider>
</>
);
return (
<>
<GoogleTagManagerBody />
<MantineProvider
theme={{
/** Put your mantine theme override here */
colorScheme: 'light',
breakpoints: {
xs: '360px',
sm: '540px',
md: '720px',
lg: '1080px',
xl: '1200px',
},
fontFamily: font.style.fontFamily,
}}
withGlobalStyles
withNormalizeCSS
>
<SessionContextProvider
initialSession={pageProps.initialSession}
supabaseClient={supabaseClient}
>
<SWRConfig value={{ fetcher }}>
<Component {...pageProps} />
</SWRConfig>
</SessionContextProvider>
</MantineProvider>
</>
);
};

export default MyApp;
4 changes: 2 additions & 2 deletions packages/database/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if (connectionString === undefined) {
}

// eslint-disable-next-line import/no-default-export -- for drizzle
export default {
export default ({
schema: './src/models/index.ts',
out: './drizzle',
driver: 'pg',
Expand All @@ -16,4 +16,4 @@ export default {
},
verbose: true,
strict: true,
} satisfies Config;
} satisfies Config);
Loading

0 comments on commit 1117cbc

Please sign in to comment.