diff --git a/.storybook/main.ts b/.storybook/main.ts index 6addc407..429d8ad4 100644 --- a/.storybook/main.ts +++ b/.storybook/main.ts @@ -1,32 +1,32 @@ -import { type StorybookConfig } from "@storybook/nextjs"; -import { merge } from "merge-anything"; +import { type StorybookConfig } from '@storybook/nextjs' +import { merge } from 'merge-anything' -import { dirname, join } from "path"; +import { dirname, join } from 'path' const config: StorybookConfig = { - stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"], + stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'], staticDirs: [ { - from: "../public", - to: "/", + from: '../public', + to: '/', }, ], addons: [ - getAbsolutePath("@storybook/addon-a11y"), - getAbsolutePath("@storybook/addon-links"), - getAbsolutePath("@storybook/addon-essentials"), - getAbsolutePath("@storybook/addon-interactions"), + getAbsolutePath('@storybook/addon-a11y'), + getAbsolutePath('@storybook/addon-links'), + getAbsolutePath('@storybook/addon-essentials'), + getAbsolutePath('@storybook/addon-interactions'), ], framework: { - name: "@storybook/nextjs", + name: '@storybook/nextjs', options: {}, }, docs: { - autodocs: "tag", + autodocs: 'tag', }, typescript: { check: true, - reactDocgen: "react-docgen-typescript", //'react-docgen-typescript', + reactDocgen: 'react-docgen-typescript', //'react-docgen-typescript', reactDocgenTypescriptOptions: { shouldExtractLiteralValuesFromEnum: true, shouldExtractValuesFromUnion: true, @@ -42,14 +42,14 @@ const config: StorybookConfig = { // 'next-i18next': 'react-i18next', }, }, - }; - const mergedConfig = merge(config, configAdditions); - return mergedConfig; + } + const mergedConfig = merge(config, configAdditions) + return mergedConfig }, -}; +} -export default config; +export default config function getAbsolutePath(value: string): string { - return dirname(require.resolve(join(value, "package.json"))); + return dirname(require.resolve(join(value, 'package.json'))) } diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 14d43838..e01ec016 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -1,16 +1,16 @@ -import { Global, MantineProvider } from "@mantine/core"; -import { type MantineProviderProps } from "@mantine/core"; -import { INITIAL_VIEWPORTS } from "@storybook/addon-viewport"; -import { type StoryFn } from "@storybook/react"; -import { type ReactNode } from "react"; -import { I18nextProvider } from "react-i18next"; +import { Global, MantineProvider } from '@mantine/core' +import { type MantineProviderProps } from '@mantine/core' +import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport' +import { type StoryFn } from '@storybook/react' +import { type ReactNode } from 'react' +import { I18nextProvider } from 'react-i18next' -import { i18n, i18nLocales } from "./i18next"; -import { storybookFont } from "../src/styles"; -import { theme } from "../src/styles/theme"; +import { i18n, i18nLocales } from './i18next' +import { storybookFont } from '../src/styles' +import { theme } from '../src/styles/theme' export const parameters = { - layout: "centered", + layout: 'centered', controls: { matchers: { color: /(background|color)$/i, @@ -18,17 +18,17 @@ export const parameters = { }, }, i18n, - locale: "en", + locale: 'en', locales: i18nLocales, viewport: { viewports: INITIAL_VIEWPORTS, }, -}; -const mantineProviderProps: Omit = { +} +const mantineProviderProps: Omit = { withCSSVariables: false, withGlobalStyles: true, withNormalizeCSS: false, -}; +} const ThemeWrapper = ({ children }: DecoratorProps) => { return ( @@ -38,8 +38,8 @@ const ThemeWrapper = ({ children }: DecoratorProps) => { {children} {/* */} - ); -}; + ) +} export const decorators = [ (Story: StoryFn) => ( @@ -47,8 +47,8 @@ export const decorators = [ ), -]; +] type DecoratorProps = { - children: ReactNode; -}; + children: ReactNode +} diff --git a/prisma/dataMigrationRunner.ts b/prisma/dataMigrationRunner.ts index 10f72349..17572a98 100644 --- a/prisma/dataMigrationRunner.ts +++ b/prisma/dataMigrationRunner.ts @@ -8,9 +8,9 @@ import { type ListrTaskWrapper, PRESET_TIMER, PRESET_TIMESTAMP, -} from "listr2"; +} from 'listr2' -import * as jobList from "./data-migrations"; +import * as jobList from './data-migrations' /** * Job Runner @@ -22,18 +22,18 @@ const rendererOptions = { outputBar: 10, persistentOutput: true, timer: PRESET_TIMER, -} satisfies ListrJob["rendererOptions"]; +} satisfies ListrJob['rendererOptions'] const injectOptions = (job: ListrJob): ListrJob => ({ ...job, rendererOptions, -}); +}) const jobs = new Listr( Object.values(jobList).map((job) => injectOptions(job)), { rendererOptions: { - formatOutput: "wrap", + formatOutput: 'wrap', timer: PRESET_TIMER, suffixSkips: true, }, @@ -42,21 +42,17 @@ const jobs = new Listr( timestamp: PRESET_TIMESTAMP, }, exitOnError: false, - }, -); + } +) -jobs.run(); +jobs.run() export type Context = { - error?: boolean; -}; -export type PassedTask = ListrTaskWrapper< - Context, - ListrDefaultRenderer, - ListrDefaultRenderer ->; -export type ListrJob = ListrTaskObj; + error?: boolean +} +export type PassedTask = ListrTaskWrapper +export type ListrJob = ListrTaskObj export type ListrTask = ( ctx: Context, - task: PassedTask, -) => void | Promise> | Listr; + task: PassedTask +) => void | Promise> | Listr diff --git a/src/server/api/routers/stories.ts b/src/server/api/routers/stories.ts index 872d1652..ed5a5abf 100644 --- a/src/server/api/routers/stories.ts +++ b/src/server/api/routers/stories.ts @@ -66,7 +66,9 @@ export const storyRouter = createTRPCRouter({ tag: category.tag, }, })), - pronouns: pronouns.map(({ pronoun }) => ({ pronoun: pronoun.pronounsEN })), + pronouns: pronouns.map(({ pronoun }) => ({ + pronoun: pronoun.pronounsEN, + })), } return formatted } @@ -107,7 +109,9 @@ export const storyRouter = createTRPCRouter({ tag: category.tag, }, })), - pronouns: pronouns.map(({ pronoun }) => ({ pronoun: pronoun.pronounsES })), + pronouns: pronouns.map(({ pronoun }) => ({ + pronoun: pronoun.pronounsES, + })), } return formatted }), @@ -159,7 +163,13 @@ export const storyRouter = createTRPCRouter({ return formatted }), getByCategory: publicProcedure - .input(z.object({ tag: z.string(), take: z.number().optional(), locale: z.enum(['en', 'es']) })) + .input( + z.object({ + tag: z.string(), + take: z.number().optional(), + locale: z.enum(['en', 'es']), + }) + ) .query(async ({ ctx, input }) => { if (input.locale === 'en') { const stories = await ctx.prisma.story.findMany({ @@ -173,7 +183,9 @@ export const storyRouter = createTRPCRouter({ categories: { select: { category: { select: { categoryEN: true, id: true } } }, }, - pronouns: { select: { pronoun: { select: { id: true, pronounsEN: true } } } }, + pronouns: { + select: { pronoun: { select: { id: true, pronounsEN: true } } }, + }, response1EN: true, response2EN: true, }, @@ -204,8 +216,12 @@ export const storyRouter = createTRPCRouter({ select: { id: true, name: true, - categories: { select: { category: { select: { categoryES: true, id: true } } } }, - pronouns: { select: { pronoun: { select: { id: true, pronounsES: true } } } }, + categories: { + select: { category: { select: { categoryES: true, id: true } } }, + }, + pronouns: { + select: { pronoun: { select: { id: true, pronounsES: true } } }, + }, response1ES: true, response2ES: true, },