Skip to content

Commit

Permalink
cleanup imports/lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeKarow committed Mar 13, 2024
1 parent fb41c56 commit eb2b75b
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 77 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { createStyles, Grid, rem, Stack } from '@mantine/core'
import { Grid, Stack } from '@mantine/core'
import dynamic from 'next/dynamic'
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'
import { type GetServerSideProps } from 'nextjs-routes'
import { type ReactNode, Suspense, useEffect, useState } from 'react'
import { type Path, useFieldArray, useForm } from 'react-hook-form'
import { /*type Path,*/ useFieldArray, useForm } from 'react-hook-form'
import { Textarea, TextInput } from 'react-hook-form-mantine'
import { type Merge } from 'type-fest'
// import { type Merge } from 'type-fest'
import { z } from 'zod'

import { prefixedId } from '@weareinreach/api/schemas/idPrefix'
Expand All @@ -31,8 +31,7 @@ const FreetextObject = z
})
.nullish()

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type MapValue<A> = A extends Map<any, infer V> ? V : never
// type MapValue<A> = A extends Map<any, infer V> ? V : never

const literalSchema = z.union([z.string(), z.number(), z.boolean(), z.null()])
type Literal = z.infer<typeof literalSchema>
Expand Down Expand Up @@ -95,10 +94,10 @@ const EditServicePage = () => {
const activeServices = form.watch('services') ?? []

type AttrSectionKeys = 'clientsServed' | 'cost' | 'eligibility' | 'languages' | 'additionalInfo'
type AttrSectionVals = Merge<
FormSchemaType['attributes'][number],
{ _rhfName: Path<FormSchemaType>; _rhfLabel: string }
>
// type AttrSectionVals = Merge<
// FormSchemaType['attributes'][number],
// { _rhfName: Path<FormSchemaType>; _rhfLabel: string }
// >

const attributeBase: {
[key in AttrSectionKeys]: ReactNode[]
Expand Down Expand Up @@ -264,7 +263,7 @@ export const getServerSideProps: GetServerSideProps = async ({ locale, params, r
})
.safeParse(params)
if (!urlParams.success) return { notFound: true }
const { slug, orgLocationId, orgServiceId } = urlParams.data
const { slug, orgLocationId: _, orgServiceId } = urlParams.data
const session = await checkServerPermissions({
ctx: { req, res },
permissions: ['dataPortalBasic'],
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/pages/org/[slug]/[orgLocationId]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStyles, Divider, Grid, Skeleton, Stack, Tabs, useMantineTheme } from '@mantine/core'
import { createStyles, Divider, Grid, Stack, Tabs, useMantineTheme } from '@mantine/core'
import { useMediaQuery } from '@mantine/hooks'
// import compact from 'just-compact'
import { type GetStaticPaths, type GetStaticPropsContext, type NextPage } from 'next'
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/pages/org/[slug]/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStyles, Divider, Grid, Skeleton, Stack, Tabs, useMantineTheme } from '@mantine/core'
import { createStyles, Divider, Grid, Stack, Tabs, useMantineTheme } from '@mantine/core'
import { useElementSize, useMediaQuery } from '@mantine/hooks'
import { type GetStaticPaths, type GetStaticPropsContext, type InferGetStaticPropsType } from 'next'
import dynamic from 'next/dynamic'
Expand Down
130 changes: 65 additions & 65 deletions apps/app/src/providers/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
'use client'
import { MantineProvider } from '@mantine/core'
import dynamic, { type LoaderComponent } from 'next/dynamic'
import { Noto_Color_Emoji, Work_Sans } from 'next/font/google'
// import dynamic, { type LoaderComponent } from 'next/dynamic'
import { /*Noto_Color_Emoji,*/ Work_Sans } from 'next/font/google'
import { type Session } from 'next-auth'
import { SessionProvider } from 'next-auth/react'
import { Trans, useTranslation } from 'next-i18next'
import { type ComponentPropsWithoutRef, useMemo } from 'react'
import { type ConsentBanner, type ConsentOptions } from 'react-hook-consent'
// import { Trans, useTranslation } from 'next-i18next'
// import { type ComponentPropsWithoutRef, useMemo } from 'react'
// import { type ConsentBanner, type ConsentOptions } from 'react-hook-consent'

import { EditModeProvider } from '@weareinreach/ui/providers/EditMode'
import { GoogleMapsProvider } from '@weareinreach/ui/providers/GoogleMaps'
import { SearchStateProvider } from '@weareinreach/ui/providers/SearchState'
import { appCache, appTheme } from '@weareinreach/ui/theme'
import 'react-hook-consent/dist/styles/style.css'

const fallbackEmoji = Noto_Color_Emoji({ weight: '400', subsets: ['emoji'] })
// const fallbackEmoji = Noto_Color_Emoji({ weight: '400', subsets: ['emoji'] })

const fontWorkSans = Work_Sans({
subsets: ['latin-ext'],
Expand All @@ -33,68 +33,68 @@ const fontWorkSans = Work_Sans({
],
})

const PrivacyStatementModal = dynamic(
() =>
import('@weareinreach/ui/modals/PrivacyStatement').then(
(mod) => mod.PrivacyStatementModal
) satisfies LoaderComponent
)
const Link = dynamic(() => import('@weareinreach/ui/components/core/Link').then((mod) => mod.Link))
// const PrivacyStatementModal = dynamic(
// () =>
// import('@weareinreach/ui/modals/PrivacyStatement').then(
// (mod) => mod.PrivacyStatementModal
// ) satisfies LoaderComponent
// )
// const Link = dynamic(() => import('@weareinreach/ui/components/core/Link').then((mod) => mod.Link))

export const Providers = ({ children, session }: ProviderProps) => {
const { t } = useTranslation('common')
// const { t } = useTranslation('common')

const consentOptions: ConsentOptions = useMemo(
() => ({
services: [
{
id: 'basic',
name: t('cookie-consent.item-basic'),
mandatory: true,
},
{
id: 'ga4',
name: t('cookie-consent.item-ga4'),
scripts: [
{
id: 'ga4-consent',
code: `window.gtag && window.gtag('consent', 'update', {ad_storage: 'granted', analytics_storage: 'granted'})`,
},
],
},
],
theme: 'light',
}),
[t]
)
// const consentOptions: ConsentOptions = useMemo(
// () => ({
// services: [
// {
// id: 'basic',
// name: t('cookie-consent.item-basic'),
// mandatory: true,
// },
// {
// id: 'ga4',
// name: t('cookie-consent.item-ga4'),
// scripts: [
// {
// id: 'ga4-consent',
// code: `window.gtag && window.gtag('consent', 'update', {ad_storage: 'granted', analytics_storage: 'granted'})`,
// },
// ],
// },
// ],
// theme: 'light',
// }),
// [t]
// )

const consentBannerSettings: ConsentBannerOpts = useMemo(
() => ({
settings: {
modal: {
title: t('cookie-consent.modal-title'),
approve: { label: t('cookie-consent.approve-selected') },
approveAll: { label: t('cookie-consent.approve-all') },
decline: { label: t('words.decline') },
description: (
<Trans
i18nKey='cookie-consent.body'
components={{
PrivacyLink: (
/* @ts-expect-error -> This is a dynamic component */
<PrivacyStatementModal component={Link} variant='inlineInvertedUtil1' />
),
}}
/>
),
},
label: t('words.customize'),
},
approve: { label: t('words.accept') },
decline: { label: t('words.decline') },
}),
[t]
)
// const consentBannerSettings: ConsentBannerOpts = useMemo(
// () => ({
// settings: {
// modal: {
// title: t('cookie-consent.modal-title'),
// approve: { label: t('cookie-consent.approve-selected') },
// approveAll: { label: t('cookie-consent.approve-all') },
// decline: { label: t('words.decline') },
// description: (
// <Trans
// i18nKey='cookie-consent.body'
// components={{
// PrivacyLink: (
// /* @ts-expect-error -> This is a dynamic component */
// <PrivacyStatementModal component={Link} variant='inlineInvertedUtil1' />
// ),
// }}
// />
// ),
// },
// label: t('words.customize'),
// },
// approve: { label: t('words.accept') },
// decline: { label: t('words.decline') },
// }),
// [t]
// )

return (
<MantineProvider
Expand Down Expand Up @@ -127,4 +127,4 @@ type ProviderProps = {
session: Session
}

type ConsentBannerOpts = ComponentPropsWithoutRef<typeof ConsentBanner>
// type ConsentBannerOpts = ComponentPropsWithoutRef<typeof ConsentBanner>

0 comments on commit eb2b75b

Please sign in to comment.