Skip to content

Commit

Permalink
fix: issue with exports
Browse files Browse the repository at this point in the history
  • Loading branch information
sajald77 committed Jul 30, 2024
1 parent cfcf58a commit c737d74
Show file tree
Hide file tree
Showing 22 changed files with 52 additions and 40 deletions.
4 changes: 2 additions & 2 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
# . "$(dirname -- "$0")/_/husky.sh"
. "$(dirname -- "$0")/_/husky.sh"

# yarn tsc
yarn tsc
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Provider } from 'jotai'
import { useEffect } from 'react'
import { Outlet, ScrollRestoration } from 'react-router-dom'

import { client } from './config'
import { client } from './config/apollo-client'
import { Head } from './config/Head'
import { configMatomo } from './config/matomo'
import { AuthProvider, ChakraThemeProvider, NavProvider, ServiceWorkerProvider } from './context'
Expand Down
2 changes: 1 addition & 1 deletion src/config/apollo-client/apolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createClient } from 'graphql-ws'
import { __development__ } from '../../shared/constants'
import { toInt } from '../../utils'
import { getAppEndPoint } from '../domain'
import { cache } from './apollo-client-cache'
import { cache } from './apolloClientCache'

const retryLink = new RetryLink({
attempts(count, _, error) {
Expand Down
1 change: 1 addition & 0 deletions src/config/apollo-client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { client } from './apolloClient'
5 changes: 0 additions & 5 deletions src/config/index.ts

This file was deleted.

3 changes: 2 additions & 1 deletion src/config/routes/hooks/useMatchRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { useSetAtom } from 'jotai'
import { useEffect } from 'react'
import { matchRoutes, useLocation } from 'react-router-dom'

import { matchRoutesAtom, platformRoutes } from '@/config'
import { platformRoutes } from '../routes'
import { matchRoutesAtom } from '../state/routesAtom'

/**
* Keeps track of which defined route the user is currently on
Expand Down
14 changes: 9 additions & 5 deletions src/config/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
export * from './components/PrivateRoute'
export * from './routes'
export * from './state/historyRouteAtom'
export * from './state/privateRoutesAtom'
export * from './state/routesAtom'
export { PrivateRoute, renderPrivateRoute } from './components/PrivateRoute'
export { platformRoutes, router } from './routes'
export { historyRouteAtom, historyRouteSetAtom } from './state/historyRouteAtom'
export {
routeMatchForProjectPageAtom,
routesForProjectCreatorAtom,
useRouteMatchesForPrivateRoute,
} from './state/privateRoutesAtom'
export { currentRouteAtom, matchRoutesAtom } from './state/routesAtom'
16 changes: 16 additions & 0 deletions src/config/routes/routeGroups.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import { Getter } from 'jotai'

import { getPath, PathName } from '@/shared/constants'

import { currentRouteAtom } from './state/routesAtom'

/** Get the functions you can pass into a derived atom definition */
export const routeMatchForAtom =
(
/** arrray of route patterns you'd like to match with the current route */
routes: string[],
) =>
(get: Getter) => {
const matchRoute = get(currentRouteAtom)
if (!matchRoute) return false
return routes.some((route) => route === matchRoute.path)
}

export const creatorProjectCreationRoutes = [
getPath('launch'),
getPath('launchProject', PathName.projectId),
Expand Down
2 changes: 1 addition & 1 deletion src/config/routes/state/privateRoutesAtom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
creatorProjectCreationRoutes as routesForPrivateProjectLaunch,
entryCreationRoutes as routesForEntryCreation,
projectCreatorRoutes as routesForProjectCreator,
routeMatchForAtom,
} from '../routeGroups'
import { routeMatchForAtom } from './routesAtom'

const routesForPrivateProjectLaunchAtom = atom(routeMatchForAtom(routesForPrivateProjectLaunch))

Expand Down
14 changes: 1 addition & 13 deletions src/config/routes/state/routesAtom.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { atom, Getter } from 'jotai'
import { atom } from 'jotai'
import { RouteMatch, RouteObject } from 'react-router-dom'

/** Atom to store matches for all routes for the platform */
Expand All @@ -25,15 +25,3 @@ export const currentRouteAtom = atom((get) => {

return matchRoute
})

/** Get the functions you can pass into a derived atom definition */
export const routeMatchForAtom =
(
/** arrray of route patterns you'd like to match with the current route */
routes: string[],
) =>
(get: Getter) => {
const matchRoute = get(currentRouteAtom)
if (!matchRoute) return false
return routes.some((route) => route === matchRoute.path)
}
2 changes: 1 addition & 1 deletion src/config/theme/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './theme'
export { theme } from './theme'
1 change: 1 addition & 0 deletions src/config/theme/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,4 +174,5 @@ const finalTheme = {
...theme,
colors: lightModeColors,
}
/** This is only used for chakra types generation process */
export default extendTheme(finalTheme)
4 changes: 3 additions & 1 deletion src/context/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import { extendTheme, ThemeProvider, ThemeProviderProps, useColorMode } from '@c
import { useEffect } from 'react'
import { ThemeProvider as ReactJSSThemeProvider } from 'react-jss'

import { theme } from '../config'
import { theme } from '@/config/theme'

import { darkModeColors, lightModeColors } from '../styles'
import { UserSetColorMode } from '../utils'
import { useThemeDetector } from '../utils/hooks'

export type AppTheme = typeof theme & {
colors: typeof lightModeColors
isNostrColor: boolean
Expand Down
3 changes: 1 addition & 2 deletions src/modules/navigation/topNavBar/topNavBarAtom.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { atom, useAtomValue } from 'jotai'

import { routeMatchForAtom } from '@/config'

import {
entryCreationRoutes,
fallBackRoutes,
Expand All @@ -11,6 +9,7 @@ import {
projectPostCreatorRoutes,
projectRewardCreatorRoutes,
projectRoutes,
routeMatchForAtom,
} from '../../../config/routes/routeGroups'
import { getPath, PathName } from '../../../shared/constants'
import { profileSideNavAtom } from '../profileNav/profileSideNavAtom'
Expand Down
2 changes: 1 addition & 1 deletion src/modules/project/navigation/projectNavigationAtom.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { atom } from 'jotai'

import { routeMatchForAtom } from '@/config'
import {
ProjectPageRoutesWithNavBarForDesktop,
ProjectPageRoutesWithNavBarForMobile,
routeMatchForAtom,
} from '@/config/routes/routeGroups'

export const showProjectNavBarForMobileAtom = atom(routeMatchForAtom(ProjectPageRoutesWithNavBarForMobile))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { atom } from 'jotai'

import { currentRouteAtom, routeMatchForAtom } from '@/config'
import { currentRouteAtom } from '@/config/routes'
import { routeMatchForAtom } from '@/config/routes/routeGroups'
import { getPath, PathName } from '@/shared/constants'

import { projectDashboardItems } from './dashboardNavData'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Box, VStack } from '@chakra-ui/react'
import { Outlet } from 'react-router-dom'

import { Head } from '@/config/Head'
import { standardPadding } from '@/styles'

import { Head } from '../../../../config'
import { dimensions } from '../../../../shared/constants'
import { useProjectAtom } from '../../hooks/useProjectAtom'
import { ProjectNavigation } from '../../navigation/ProjectNavigation'
Expand Down
3 changes: 2 additions & 1 deletion src/pages/fallback/NotAuthorized.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Button, Image, Text, VStack } from '@chakra-ui/react'
import { useTranslation } from 'react-i18next'
import { useNavigate } from 'react-router-dom'

import { Head } from '../../config'
import { Head } from '@/config/Head'

import { useServiceWorkerUpdate } from '../../context'
import { NotAuthorizedImageUrl } from '../../shared/constants/platform/url'
import { CommonFeedbackMessage } from './CommonFeedbackMessage'
Expand Down
3 changes: 2 additions & 1 deletion src/pages/fallback/NotFoundPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Button, Image, Text, VStack } from '@chakra-ui/react'
import { useTranslation } from 'react-i18next'
import { useMatch } from 'react-router-dom'

import { Head } from '../../config'
import { Head } from '@/config/Head'

import { useServiceWorkerUpdate } from '../../context'
import { getPath } from '../../shared/constants'
import { NotFoundPageImageUrl } from '../../shared/constants/platform/url'
Expand Down
3 changes: 2 additions & 1 deletion src/pages/fallback/NotFoundProject.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Box, Image, Text, VStack } from '@chakra-ui/react'
import { useTranslation } from 'react-i18next'

import { Head } from '@/config/Head'

import { Body1 } from '../../components/typography'
import { Head } from '../../config'
import { NotFoundPageImageUrl } from '../../shared/constants/platform/url'

export const NotFoundProject = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/grants/grantsPage/GrantPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import { useTranslation } from 'react-i18next'
import { FaArrowLeft } from 'react-icons/fa'
import { useNavigate, useParams } from 'react-router-dom'

import { Head } from '@/config/Head'

import Loader from '../../../components/ui/Loader'
import { Head } from '../../../config'
import { useAuthContext } from '../../../context'
import { getPath } from '../../../shared/constants'
import {
Expand Down

0 comments on commit c737d74

Please sign in to comment.