Skip to content

Commit

Permalink
simplify and consolidate app scaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
a-type committed Jun 14, 2024
1 parent 4da9e20 commit 4c77fb8
Show file tree
Hide file tree
Showing 70 changed files with 1,623 additions and 456 deletions.
2 changes: 1 addition & 1 deletion apps/gnocchi/hub/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"typecheck": "tsc --build tsconfig.json"
},
"dependencies": {
"@a-type/ui": "^0.8.20",
"@a-type/ui": "^0.8.21",
"@a-type/utils": "^1.0.8",
"@tiptap/core": "^2.2.4",
"@tiptap/extension-document": "^2.2.4",
Expand Down
3 changes: 1 addition & 2 deletions apps/gnocchi/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"typecheck": "tsc --build tsconfig.json"
},
"dependencies": {
"@a-type/ui": "^0.8.20",
"@a-type/ui": "^0.8.21",
"@a-type/utils": "^1.0.8",
"@biscuits/client": "workspace:*",
"@biscuits/error": "workspace:*",
Expand Down Expand Up @@ -59,7 +59,6 @@
"prosemirror-model": "1.21.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hot-toast": "^2.3.0",
"react-lazy-with-preload": "^2.2.1",
"react-use-measure": "^2.1.1",
"stopword": "^2.0.8",
Expand Down
45 changes: 12 additions & 33 deletions apps/gnocchi/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
import classNames from 'classnames';
import { Suspense, useLayoutEffect, useState } from 'react';
import { Toaster } from 'react-hot-toast';
import { Pages } from './pages/Pages.jsx';
import { Provider as GroceriesProvider } from './stores/groceries/Provider.jsx';
import { IconSpritesheet } from '@a-type/ui/components/icon';
import { ReloadButton } from '@/components/sync/ReloadButton.jsx';
import { GlobalLoader } from '@/GlobalLoader.jsx';
import { useVisualViewportOffset } from '@a-type/ui/hooks';
import { ErrorBoundary } from '@a-type/ui/components/errorBoundary';
import { TooltipProvider } from '@a-type/ui/components/tooltip';
import { P, H1 } from '@a-type/ui/components/typography';
import { ParticleLayer } from '@a-type/ui/components/particles';
import { GlobalSyncingIndicator } from '@/components/sync/GlobalSyncingIndicator.jsx';
import { AppPreviewNotice, Provider } from '@biscuits/client';
import { graphqlClient } from './graphql.js';
import { groceriesDescriptor } from './stores/groceries/index.js';
import { Provider as UIProvider } from '@a-type/ui/components/provider';
import { H1, P } from '@a-type/ui/components/typography';
import { Provider } from '@biscuits/client';
import classNames from 'classnames';
import { Suspense } from 'react';
import { AppMoved } from './components/promotional/AppMoved.jsx';
import { Pages } from './pages/Pages.jsx';
import { groceriesDescriptor } from './stores/groceries/index.js';
import { Provider as GroceriesProvider } from './stores/groceries/Provider.jsx';

export function App() {
useLayoutEffect(() => {
if (typeof window !== 'undefined') {
document.body.className = 'theme-lemon';
}
}, []);

useVisualViewportOffset();

return (
<div
className={classNames(
Expand All @@ -34,26 +20,19 @@ export function App() {
)}
>
<ErrorBoundary fallback={<ErrorFallback />}>
<TooltipProvider>
<UIProvider>
<Suspense fallback={<GlobalLoader />}>
<Provider
graphqlClient={graphqlClient}
appId="gnocchi"
storeDescriptor={groceriesDescriptor as any}
>
<GroceriesProvider>
<ParticleLayer>
<AppPreviewNotice />
<Pages />
<Toaster position="top-center" containerClassName="mt-1" />
<IconSpritesheet />
<GlobalSyncingIndicator />
<AppMoved />
</ParticleLayer>
<Pages />
<AppMoved />
</GroceriesProvider>
</Provider>
</Suspense>
</TooltipProvider>
</UIProvider>
</ErrorBoundary>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/gnocchi/web/src/components/foods/FoodNamesEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '@a-type/ui/components/forms';
import { Cross2Icon, PlusIcon } from '@radix-ui/react-icons';
import { useState } from 'react';
import { toast } from 'react-hot-toast';
import { toast } from '@a-type/ui';

export interface FoodNamesEditorProps {
names: FoodAlternateNames;
Expand Down
2 changes: 1 addition & 1 deletion apps/gnocchi/web/src/components/promotional/AppMoved.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '@biscuits/client';
import { Link } from '@verdant-web/react-router';
import { Icon } from '@a-type/ui/components/icon';
import { toast } from 'react-hot-toast';
import { toast } from '@a-type/ui';
import { Button } from '@a-type/ui/components/button';
import { ExportDataButton } from '@biscuits/client/storage';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import {
PopoverTrigger,
} from '@a-type/ui/components/popover';
import { Note } from '@a-type/ui/components/note';
import { HOME_ORIGIN } from 'node_modules/@biscuits/client/src/config.js';
import { CONFIG } from '@biscuits/client';

export interface CookingActionBarProps {
recipe: Recipe;
Expand Down Expand Up @@ -130,7 +130,7 @@ function AddChefsAction() {
device sync, grocery collaboration, and web recipe scanning.
</p>
<p>
<TextLink newTab to={`${HOME_ORIGIN}/join`}>
<TextLink newTab to={`${CONFIG.HOME_ORIGIN}/join`}>
Learn more about subscription features.
</TextLink>
</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
import { Recipe } from '@gnocchi.biscuits/verdant';
import { format } from 'date-fns/esm';
import { useState } from 'react';
import { toast } from 'react-hot-toast';
import { toast } from '@a-type/ui';

export interface RecipePublishControlProps {
recipe: Recipe;
Expand Down
6 changes: 0 additions & 6 deletions apps/gnocchi/web/src/graphql.ts

This file was deleted.

2 changes: 1 addition & 1 deletion apps/gnocchi/web/src/pages/PlanPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { ArrowRightIcon } from '@radix-ui/react-icons';
import { ReactNode, useEffect } from 'react';
import { groceriesDescriptor } from '@/stores/groceries/index.js';
import { AutoRestoreScroll } from '@/components/nav/AutoRestoreScroll.jsx';
import { toast } from 'react-hot-toast';
import { toast } from '@a-type/ui';

const contents = {
offline: OfflineContents,
Expand Down
4 changes: 2 additions & 2 deletions apps/gnocchi/web/src/stores/groceries/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { pickBestNameMatch } from '@/components/foods/lookup.jsx';
import { groceriesState } from '@/components/groceries/state.js';
import { graphqlClient } from '@/graphql.js';
import { graphqlClient } from '@biscuits/client';
import { getVerdantSync, graphql, VerdantContext } from '@biscuits/client';
import { parseIngredient } from '@gnocchi.biscuits/conversion';
import { depluralize } from '@gnocchi.biscuits/conversion';
Expand All @@ -24,7 +24,7 @@ import { useSearchParams } from '@verdant-web/react-router';
import cuid from 'cuid';
import pluralize from 'pluralize';
import { useCallback } from 'react';
import { toast } from 'react-hot-toast';
import { toast } from '@a-type/ui';
import { getScannedRecipe } from './scanRecipe.js';

export interface Presence {
Expand Down
6 changes: 3 additions & 3 deletions apps/gnocchi/web/src/stores/groceries/scanRecipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import {
graphql,
isClientError,
showSubscriptionPromotion,
graphqlClient,
} from '@biscuits/client';
import { detailedInstructionsToDoc, instructionsToDoc } from '@/lib/tiptap.js';
import { BiscuitsError } from '@biscuits/error';
import { lookupUnit, parseIngredient } from '@gnocchi.biscuits/conversion';
import { graphqlClient } from '@/graphql.js';
import { RecipeInit, Client } from '@gnocchi.biscuits/verdant';
import { toast } from 'react-hot-toast';
import { toast } from '@a-type/ui';

const recipeScanQuery = graphql(`
query RecipeScan($input: RecipeScanInput!) {
Expand Down Expand Up @@ -82,7 +82,7 @@ export async function getScannedRecipe(
comments: [...(i.comments ?? [])],
text: i.original,
note: i.note,
isSectionHeader: i.isSectionHeader,
isSectionHeader: i.isSectionHeader ?? undefined,
};
});
} else if (scanned.rawIngredients?.length) {
Expand Down
5 changes: 2 additions & 3 deletions apps/marginalia/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"private": true,
"type": "module",
"scripts": {
"app-dev": "vite --open --serve",
"app-dev": "vite --host --open",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@a-type/ui": "0.8.20",
"@a-type/ui": "0.8.21",
"@a-type/utils": "1.1.0",
"@biscuits/client": "workspace:*",
"@marginalia.biscuits/verdant": "workspace:*",
Expand All @@ -19,7 +19,6 @@
"classnames": "^2.5.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hot-toast": "^2.4.1",
"unocss": "0.60.3",
"valtio": "^1.13.2",
"workbox-core": "^7.1.0",
Expand Down
38 changes: 9 additions & 29 deletions apps/marginalia/web/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
import { clientDescriptor, hooks } from '@/store.js';
import { ReactNode, Suspense, useLayoutEffect } from 'react';
import { Pages } from '@/pages/Pages.jsx';
import { useVisualViewportOffset } from '@a-type/ui/hooks';
import { Toaster } from 'react-hot-toast';
import { IconSpritesheet } from '@a-type/ui/components/icon';
import { clientDescriptor, hooks } from '@/store.js';
import { ErrorBoundary } from '@a-type/ui/components/errorBoundary';
import { TooltipProvider } from '@a-type/ui/components/tooltip';
import { ParticleLayer } from '@a-type/ui/components/particles';
import { PrereleaseWarning, ReloadButton } from '@biscuits/client';
import { Provider as UIProvider } from '@a-type/ui/components/provider';
import { H1, P } from '@a-type/ui/components/typography';
import {
useCanSync,
Provider,
createGraphQLClient,
AppPreviewNotice,
} from '@biscuits/client';
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
import { useVisualViewportOffset } from '@a-type/ui/hooks';
import { Provider, ReloadButton, useCanSync } from '@biscuits/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactNode, Suspense, useLayoutEffect } from 'react';

export interface AppProps {}

const graphqlClient = createGraphQLClient();
const queryClient = new QueryClient({
defaultOptions: {
queries: {
Expand All @@ -39,30 +29,20 @@ export function App({}: AppProps) {

return (
<ErrorBoundary fallback={<ErrorFallback />}>
<TooltipProvider>
<UIProvider>
<Suspense>
<Provider
appId="marginalia"
graphqlClient={graphqlClient}
storeDescriptor={clientDescriptor as any}
>
<VerdantProvider>
<QueryClientProvider client={queryClient}>
<ParticleLayer>
<AppPreviewNotice />
<PrereleaseWarning />
<Pages />
<Toaster
position="bottom-center"
containerClassName="mb-10 sm:mb-0"
/>
<IconSpritesheet />
</ParticleLayer>
<Pages />
</QueryClientProvider>
</VerdantProvider>
</Provider>
</Suspense>
</TooltipProvider>
</UIProvider>
</ErrorBoundary>
);
}
Expand Down
65 changes: 0 additions & 65 deletions apps/marginalia/web/src/components/nav/TopLoader.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions apps/marginalia/web/src/pages/Pages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Spinner } from '@a-type/ui/components/spinner';
import { lazy, useCallback, Suspense } from 'react';
import { updateApp, updateState } from '@/updateState.js';
import { Link } from '@verdant-web/react-router';
import { TopLoader } from '@/components/nav/TopLoader.jsx';
import { Button } from '@a-type/ui/components/button';
import { ReloadButton } from '@biscuits/client';
import { PageRoot } from '@a-type/ui/components/layouts';
Expand Down Expand Up @@ -47,7 +46,6 @@ export function Pages() {
<ErrorBoundary fallback={(props) => <ErrorFallback {...props} />}>
<Suspense fallback={<Spinner />}>
<Router routes={routes} onNavigate={handleNavigate}>
<TopLoader />
<PageRoot>
<Outlet />
</PageRoot>
Expand Down
2 changes: 1 addition & 1 deletion apps/star-chart/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<meta name="apple-mobile-web-app-capable" content="yes" />
</head>

<body>
<body class="theme-lemon">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
Expand Down
3 changes: 1 addition & 2 deletions apps/star-chart/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@a-type/ui": "0.8.20",
"@a-type/ui": "0.8.21",
"@a-type/utils": "1.1.2",
"@biscuits/client": "workspace:*",
"@react-spring/web": "^9.7.3",
Expand All @@ -21,7 +21,6 @@
"raf": "^3.4.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-hot-toast": "^2.4.1",
"react-hotkeys-hook": "^4.5.0",
"rete": "^2.0.3",
"rete-area-plugin": "^2.0.4",
Expand Down
Loading

0 comments on commit 4c77fb8

Please sign in to comment.