@terrafirmagreg-team/recipe 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/components/cards/card/index.tsx +2 -2
- package/src/components/cards/card/strip.tsx +1 -1
- package/src/components/cards/paged-card.tsx +1 -1
- package/src/components/cards/slot-hitbox.tsx +3 -3
- package/src/components/cards/strip-card/index.tsx +1 -1
- package/src/components/cards/strip-card/member-cell.tsx +1 -1
- package/src/components/embed-card.tsx +1 -0
- package/src/components/tree.tsx +4 -4
- package/src/components/views/browser/card-grid.tsx +6 -4
- package/src/components/views/browser/frame.tsx +3 -2
- package/src/components/views/browser/index.tsx +21 -0
- package/src/components/views/browser/item-panel/index.tsx +6 -5
- package/src/components/views/browser/item-panel-grid/cell.tsx +1 -1
- package/src/components/views/browser/item-panel-grid/index.tsx +1 -1
- package/src/components/views/browser/item-view/index.tsx +4 -3
- package/src/components/views/browser/item-view/tags.tsx +4 -2
- package/src/components/views/browser/query-controls.tsx +5 -6
- package/src/components/views/browser/type-view.tsx +7 -6
- package/src/components/views/calc/edge.tsx +1 -1
- package/src/components/views/calc/flow/index.tsx +1 -1
- package/src/components/views/calc/node-card/far.tsx +1 -1
- package/src/components/views/calc/node-card/full.tsx +1 -1
- package/src/components/views/landing.tsx +32 -0
- package/src/components/views/layout.tsx +14 -0
- package/src/hooks/alloy/use-mix-state.ts +4 -2
- package/src/hooks/calc/use-data.ts +1 -2
- package/src/hooks/calc/use-share.ts +4 -4
- package/src/hooks/use-add-to-calc.ts +5 -3
- package/src/hooks/use-favorite-hotkey.ts +1 -1
- package/src/hooks/use-group-outlines.ts +1 -1
- package/src/hooks/use-index.ts +1 -1
- package/src/hooks/use-item-feeds.ts +1 -1
- package/src/hooks/use-item-pane.ts +3 -4
- package/src/hooks/use-item-press.ts +3 -4
- package/src/hooks/use-item-tag-groups.ts +1 -1
- package/src/hooks/use-left-sidebar-tree.ts +1 -1
- package/src/hooks/use-panel-cells.ts +3 -3
- package/src/hooks/use-panel-tabs.ts +1 -1
- package/src/hooks/use-query.ts +10 -9
- package/src/hooks/use-session.ts +9 -5
- package/src/hooks/use-type-filter.ts +7 -6
- package/src/lib/{lookup.ts → browser/lookup.ts} +1 -1
- package/src/lib/{used-items.ts → browser/used-items.ts} +1 -1
- package/src/lib/calc/resolve.ts +1 -1
- package/src/lib/config.ts +1 -0
- package/src/lib/embed.ts +3 -0
- package/src/lib/source.ts +13 -0
- /package/src/hooks/calc/{use-session.ts → use-calc-session.ts} +0 -0
- /package/src/lib/{favorite-hover.ts → browser/favorite-hover.ts} +0 -0
- /package/src/lib/{fluid-outputs.ts → browser/fluid-outputs.ts} +0 -0
- /package/src/lib/{group.ts → browser/group.ts} +0 -0
- /package/src/lib/{panel-outline.ts → browser/panel-outline.ts} +0 -0
- /package/src/lib/{panel.ts → browser/panel.ts} +0 -0
- /package/src/lib/{recipe-slots.ts → browser/recipe-slots.ts} +0 -0
- /package/src/lib/{sidebar.ts → browser/sidebar.ts} +0 -0
- /package/src/lib/{card-model.ts → cards/model.ts} +0 -0
- /package/src/lib/{index-store.ts → client-index/store.ts} +0 -0
- /package/src/lib/{search.ts → search/index.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@terrafirmagreg-team/recipe",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Recipe viewer and calculator",
|
|
6
6
|
"license": "LGPL-3.0-only",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@terrafirmagreg-team/data": "1.2.1",
|
|
27
|
-
"@terrafirmagreg-team/dump": "1.2.
|
|
28
|
-
"@terrafirmagreg-team/game": "1.2.
|
|
29
|
-
"@terrafirmagreg-team/kit": "1.2.
|
|
30
|
-
"@terrafirmagreg-team/mdx": "1.2.
|
|
27
|
+
"@terrafirmagreg-team/dump": "1.2.2",
|
|
28
|
+
"@terrafirmagreg-team/game": "1.2.3",
|
|
29
|
+
"@terrafirmagreg-team/kit": "1.2.4",
|
|
30
|
+
"@terrafirmagreg-team/mdx": "1.2.2",
|
|
31
31
|
"@terrafirmagreg-team/preview": "1.2.1",
|
|
32
32
|
"@terrafirmagreg-team/sites": "1.2.1",
|
|
33
|
-
"@terrafirmagreg-team/translate": "1.2.
|
|
34
|
-
"@terrafirmagreg-team/ui": "1.2.
|
|
33
|
+
"@terrafirmagreg-team/translate": "1.2.4",
|
|
34
|
+
"@terrafirmagreg-team/ui": "1.2.4",
|
|
35
35
|
"comlink": "^4.4.2",
|
|
36
36
|
"fflate": "0.8.3",
|
|
37
|
-
"fumadocs-core": "16.17.
|
|
38
|
-
"lucide-react": "^
|
|
37
|
+
"fumadocs-core": "16.17.10",
|
|
38
|
+
"lucide-react": "^1.63.0",
|
|
39
39
|
"pathfinding": "0.4.18"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
cardStripGeo,
|
|
8
8
|
countCoveredText,
|
|
9
9
|
textInStrip,
|
|
10
|
-
} from '@terrafirmagreg-team/recipe/lib/
|
|
10
|
+
} from '@terrafirmagreg-team/recipe/lib/cards/model';
|
|
11
11
|
import { CardText } from '@terrafirmagreg-team/recipe/components/cards/card/text';
|
|
12
12
|
import { CardSceneOverlay } from '@terrafirmagreg-team/recipe/components/cards/card/scene';
|
|
13
13
|
import { CardWidgetTips } from '@terrafirmagreg-team/recipe/components/cards/card/tips';
|
|
14
14
|
import { CardStrip } from '@terrafirmagreg-team/recipe/components/cards/card/strip';
|
|
15
|
-
import { recipeSlots } from '@terrafirmagreg-team/recipe/lib/recipe-slots';
|
|
15
|
+
import { recipeSlots } from '@terrafirmagreg-team/recipe/lib/browser/recipe-slots';
|
|
16
16
|
import {
|
|
17
17
|
recipeMultiblock,
|
|
18
18
|
recipeSceneEntities,
|
|
@@ -5,7 +5,7 @@ import { Fragment, useRef, useState } from 'react';
|
|
|
5
5
|
import { SlotHitbox } from '@terrafirmagreg-team/recipe/components/cards/slot-hitbox';
|
|
6
6
|
import { CardText } from '@terrafirmagreg-team/recipe/components/cards/card/text';
|
|
7
7
|
import { formatCount } from '@terrafirmagreg-team/ui/lib/utils/format';
|
|
8
|
-
import type { CardStripGeo } from '@terrafirmagreg-team/recipe/lib/
|
|
8
|
+
import type { CardStripGeo } from '@terrafirmagreg-team/recipe/lib/cards/model';
|
|
9
9
|
import type { EntryTooltipLevel } from '@terrafirmagreg-team/game/components/entry/tooltip';
|
|
10
10
|
import type { RecipeTextWidget } from '@terrafirmagreg-team/recipe/lib/data/dto';
|
|
11
11
|
import type { RecipeHrefOpts } from '@terrafirmagreg-team/recipe/types';
|
|
@@ -6,7 +6,7 @@ import { SlotHitbox } from './slot-hitbox';
|
|
|
6
6
|
import { StripCard } from './strip-card';
|
|
7
7
|
import { recipeGlareFilter } from './glare-filter';
|
|
8
8
|
import { recipeGrid } from '@terrafirmagreg-team/recipe/lib/data/grid';
|
|
9
|
-
import { recipeSlots } from '@terrafirmagreg-team/recipe/lib/recipe-slots';
|
|
9
|
+
import { recipeSlots } from '@terrafirmagreg-team/recipe/lib/browser/recipe-slots';
|
|
10
10
|
import { PagerArrow } from '@terrafirmagreg-team/ui/components/blocks/page/pager';
|
|
11
11
|
import { useInView } from '@terrafirmagreg-team/ui/hooks/use-in-view';
|
|
12
12
|
import { useSwipe } from '@terrafirmagreg-team/ui/hooks/use-swipe';
|
|
@@ -11,7 +11,7 @@ import { useCycleIndex } from '@terrafirmagreg-team/ui/hooks/use-cycle-index';
|
|
|
11
11
|
import { stackDisplayName } from '@terrafirmagreg-team/game/lib/entry/display';
|
|
12
12
|
import { entryHref } from '@terrafirmagreg-team/game/lib/entry/href';
|
|
13
13
|
import { loadStackDisplay } from '@terrafirmagreg-team/game/lib/entry/tooltip';
|
|
14
|
-
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/favorite-hover';
|
|
14
|
+
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
15
15
|
import { useAsyncResult } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
16
16
|
import type { ReferenceKind } from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
17
17
|
import type { RecipeSlotWidget } from '@terrafirmagreg-team/recipe/lib/data/dto';
|
|
@@ -156,7 +156,7 @@ export function SlotHitbox({
|
|
|
156
156
|
dataset={dataset}
|
|
157
157
|
id={widget.id}
|
|
158
158
|
name={name}
|
|
159
|
-
kind={
|
|
159
|
+
kind={widgetRefKind(widget)}
|
|
160
160
|
lang={lang}
|
|
161
161
|
langMap={langMap}
|
|
162
162
|
level={tooltipLevel}
|
|
@@ -177,7 +177,7 @@ export function SlotHitbox({
|
|
|
177
177
|
dataset={dataset}
|
|
178
178
|
id={widget.id}
|
|
179
179
|
name={name}
|
|
180
|
-
kind={
|
|
180
|
+
kind={widgetRefKind(widget)}
|
|
181
181
|
lang={lang}
|
|
182
182
|
langMap={langMap}
|
|
183
183
|
level={tooltipLevel}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from '@terrafirmagreg-team/recipe/components/cards/strip-card/buttons';
|
|
12
12
|
import { StripCardMember } from '@terrafirmagreg-team/recipe/components/cards/strip-card/member-cell';
|
|
13
13
|
import { recipeGrid } from '@terrafirmagreg-team/recipe/lib/data/grid';
|
|
14
|
-
import { recipeSlots } from '@terrafirmagreg-team/recipe/lib/recipe-slots';
|
|
14
|
+
import { recipeSlots } from '@terrafirmagreg-team/recipe/lib/browser/recipe-slots';
|
|
15
15
|
import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
16
16
|
import { useInView } from '@terrafirmagreg-team/ui/hooks/use-in-view';
|
|
17
17
|
import { Hint } from '@terrafirmagreg-team/ui/components/blocks/tooltip/hint';
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { stackDisplayName } from '@terrafirmagreg-team/game/lib/entry/display';
|
|
11
11
|
import { entryHref } from '@terrafirmagreg-team/game/lib/entry/href';
|
|
12
12
|
import { loadStackDisplay } from '@terrafirmagreg-team/game/lib/entry/tooltip';
|
|
13
|
-
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/favorite-hover';
|
|
13
|
+
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
14
14
|
import { useAsyncResult } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
15
15
|
import type { ReferenceKind } from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
16
16
|
import type { RecipeGridMember } from '@terrafirmagreg-team/recipe/lib/data/dto';
|
package/src/components/tree.tsx
CHANGED
|
@@ -4,10 +4,9 @@ import { createElement } from 'react';
|
|
|
4
4
|
import type * as PageTree from 'fumadocs-core/page-tree';
|
|
5
5
|
import { Entry } from '@terrafirmagreg-team/game/components/entry/entry';
|
|
6
6
|
import { loadMergedLangMap, creativeTabName } from '@terrafirmagreg-team/dump/lib/dump/assets/lang/load';
|
|
7
|
-
import { loadClientManifest } from '@terrafirmagreg-team/dump/lib/dump/client/dump';
|
|
8
7
|
import { DUMP_POINTER_TTL } from '@terrafirmagreg-team/dump/lib/dump/json-reader';
|
|
9
8
|
import { createAsyncCache } from '@terrafirmagreg-team/data/lib/async-cache';
|
|
10
|
-
import {
|
|
9
|
+
import { getRecipeSource } from '@terrafirmagreg-team/recipe/lib/source';
|
|
11
10
|
import { keyTreeNode } from '@terrafirmagreg-team/translate/server';
|
|
12
11
|
import { loadLocaleRegistry } from '@terrafirmagreg-team/translate/server';
|
|
13
12
|
import { encodeQueryValue } from '@terrafirmagreg-team/translate/lib/url';
|
|
@@ -68,8 +67,9 @@ async function buildRecipeTrees(): Promise<SectionTrees> {
|
|
|
68
67
|
for (const lang of languages ?? [defaultLanguage]) {
|
|
69
68
|
const ref = { id };
|
|
70
69
|
const map = await loadMergedLangMap(ref, lang);
|
|
71
|
-
const
|
|
72
|
-
const
|
|
70
|
+
const source = getRecipeSource();
|
|
71
|
+
const categories = await source.categories(ref);
|
|
72
|
+
const types = (await source.manifest(ref))?.indexes.recipes.types;
|
|
73
73
|
const nonEmpty = types
|
|
74
74
|
? new Set(
|
|
75
75
|
types
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { useEffect, useState, type ReactNode, type RefObject } from 'react';
|
|
4
4
|
import { useAsyncValue } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
5
5
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
6
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
6
7
|
import { PagedCard } from '@terrafirmagreg-team/recipe/components/cards/paged-card';
|
|
7
8
|
import { RecipeDefaultMenuItem } from '@terrafirmagreg-team/recipe/components/cards/default-item';
|
|
8
9
|
import { CopyIdMenu } from '@terrafirmagreg-team/game/components/entry/copy-id-menu';
|
|
@@ -17,7 +18,7 @@ import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
|
17
18
|
import { loadClientRecipe } from '@terrafirmagreg-team/recipe/lib/client/recipe';
|
|
18
19
|
import { pushUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
19
20
|
import { useSwipe } from '@terrafirmagreg-team/ui/hooks/use-swipe';
|
|
20
|
-
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/favorite-hover';
|
|
21
|
+
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
21
22
|
import { recipeTitle } from '@terrafirmagreg-team/recipe/lib/data/parse';
|
|
22
23
|
import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
23
24
|
import type { FitDim } from '@terrafirmagreg-team/ui/hooks/page/use-fit-pages';
|
|
@@ -67,6 +68,7 @@ function RecipeGridCard({
|
|
|
67
68
|
defaultMaterial?: string;
|
|
68
69
|
}) {
|
|
69
70
|
const t = useTranslations();
|
|
71
|
+
const resolved = useResolvedLang();
|
|
70
72
|
const { dataset, lang, langMap, names, nav, index } = session;
|
|
71
73
|
const recipe = useAsyncValue(
|
|
72
74
|
() => loadClientRecipe(dataset, row.id, row.bucket),
|
|
@@ -89,17 +91,17 @@ function RecipeGridCard({
|
|
|
89
91
|
|
|
90
92
|
const focus = () =>
|
|
91
93
|
pushUrlState(
|
|
92
|
-
recipeHref(dataset,
|
|
94
|
+
recipeHref(dataset, resolved, { ...nav, id: row.id, solo: undefined }),
|
|
93
95
|
);
|
|
94
96
|
|
|
95
97
|
const isolate = () =>
|
|
96
98
|
pushUrlState(
|
|
97
|
-
recipeHref(dataset,
|
|
99
|
+
recipeHref(dataset, resolved, { ...nav, id: row.id, solo: '1' }),
|
|
98
100
|
);
|
|
99
101
|
|
|
100
102
|
const openNewTab = () =>
|
|
101
103
|
window.open(
|
|
102
|
-
recipeHref(dataset,
|
|
104
|
+
recipeHref(dataset, resolved, { ...nav, id: row.id, solo: '1' }),
|
|
103
105
|
'_blank',
|
|
104
106
|
'noopener',
|
|
105
107
|
);
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import Link from 'next/link';
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
5
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
6
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
6
7
|
import { QueryPager } from '@terrafirmagreg-team/recipe/components/views/browser/query-controls';
|
|
7
8
|
import { Pager } from '@terrafirmagreg-team/ui/components/blocks/page/pager';
|
|
8
9
|
import { RecipeToolbar } from '@terrafirmagreg-team/recipe/components/views/browser/toolbar';
|
|
@@ -38,6 +39,7 @@ export function RecipeFrame({
|
|
|
38
39
|
children: ReactNode;
|
|
39
40
|
}) {
|
|
40
41
|
const t = useTranslations();
|
|
42
|
+
const resolved = useResolvedLang();
|
|
41
43
|
const goPage = (dir: number) => {
|
|
42
44
|
if (!list || list.pages <= 1) return;
|
|
43
45
|
const next = (list.page + dir + list.pages) % list.pages;
|
|
@@ -46,7 +48,7 @@ export function RecipeFrame({
|
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
50
|
replaceUrlState(
|
|
49
|
-
recipeHref(session.dataset,
|
|
51
|
+
recipeHref(session.dataset, resolved, {
|
|
50
52
|
...session.nav,
|
|
51
53
|
id: undefined,
|
|
52
54
|
rpage: next > 0 ? next + 1 : undefined,
|
|
@@ -88,7 +90,6 @@ export function RecipeFrame({
|
|
|
88
90
|
) : (
|
|
89
91
|
<QueryPager
|
|
90
92
|
dataset={session.dataset}
|
|
91
|
-
lang={session.lang}
|
|
92
93
|
params={{ ...session.nav, id: undefined }}
|
|
93
94
|
query={session.query}
|
|
94
95
|
list={list}
|
|
@@ -21,6 +21,27 @@ import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
|
21
21
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
22
22
|
import type { RecipePageData } from '@terrafirmagreg-team/recipe/types';
|
|
23
23
|
|
|
24
|
+
export function RecipeBrowserFallback() {
|
|
25
|
+
return (
|
|
26
|
+
<div className="viewport-shell recipe-viewport not-prose flex w-full flex-col gap-3">
|
|
27
|
+
<div className="flex min-h-0 flex-1 gap-4">
|
|
28
|
+
<main className="flex min-w-0 flex-1 flex-col">
|
|
29
|
+
<Skeleton className="mb-3 h-9 w-full rounded-md" />
|
|
30
|
+
<div className="flex min-h-0 flex-1 flex-col items-center justify-start gap-2 pt-2">
|
|
31
|
+
{Array.from({ length: 6 }, (_, i) => (
|
|
32
|
+
<Skeleton
|
|
33
|
+
key={i}
|
|
34
|
+
className="h-24 rounded-md"
|
|
35
|
+
style={{ width: 240 + (i % 3) * 70 }}
|
|
36
|
+
/>
|
|
37
|
+
))}
|
|
38
|
+
</div>
|
|
39
|
+
</main>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
24
45
|
export function RecipeBrowser({
|
|
25
46
|
dataset: id,
|
|
26
47
|
datasetTitle,
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
useState,
|
|
10
10
|
} from 'react';
|
|
11
11
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
12
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
12
13
|
import { useFavorites } from '@terrafirmagreg-team/recipe/hooks/use-favorites';
|
|
13
14
|
import { useFavoriteHotkey } from '@terrafirmagreg-team/recipe/hooks/use-favorite-hotkey';
|
|
14
15
|
import { useHideUnused } from '@terrafirmagreg-team/recipe/hooks/use-hide-unused';
|
|
@@ -16,10 +17,10 @@ import { usePagedList } from '@terrafirmagreg-team/ui/hooks/page/use-paged-list'
|
|
|
16
17
|
import { useSwipe } from '@terrafirmagreg-team/ui/hooks/use-swipe';
|
|
17
18
|
import { useElementSize } from '@terrafirmagreg-team/ui/hooks/use-element-size';
|
|
18
19
|
import { EmptyState } from '@terrafirmagreg-team/ui/components/blocks/page/empty-state';
|
|
19
|
-
import { type ItemPanelMode } from '@terrafirmagreg-team/recipe/lib/panel';
|
|
20
|
+
import { type ItemPanelMode } from '@terrafirmagreg-team/recipe/lib/browser/panel';
|
|
20
21
|
import { recipeHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
21
22
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
22
|
-
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/favorite-hover';
|
|
23
|
+
import { favoriteHover } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
23
24
|
import { IconPager } from '@terrafirmagreg-team/ui/components/blocks/page/pager';
|
|
24
25
|
import { FavoriteButton } from '@terrafirmagreg-team/recipe/components/views/browser/favorite-button';
|
|
25
26
|
import { ItemPanelGrid } from '@terrafirmagreg-team/recipe/components/views/browser/item-panel-grid';
|
|
@@ -111,12 +112,13 @@ export const ItemPanel = memo(function ItemPanel({
|
|
|
111
112
|
});
|
|
112
113
|
}, []);
|
|
113
114
|
|
|
114
|
-
const
|
|
115
|
+
const resolved = useResolvedLang();
|
|
116
|
+
const onPress = useItemPress({ dataset, nav, isCalc });
|
|
115
117
|
|
|
116
118
|
const setTab = (next: string) => {
|
|
117
119
|
setPanelPage(0);
|
|
118
120
|
replaceUrlState(
|
|
119
|
-
recipeHref(dataset,
|
|
121
|
+
recipeHref(dataset, resolved, {
|
|
120
122
|
...nav,
|
|
121
123
|
tab: next || undefined,
|
|
122
124
|
}),
|
|
@@ -212,7 +214,6 @@ export const ItemPanel = memo(function ItemPanel({
|
|
|
212
214
|
<RecipeSettings />
|
|
213
215
|
<QuerySearch
|
|
214
216
|
dataset={dataset}
|
|
215
|
-
lang={lang}
|
|
216
217
|
params={nav}
|
|
217
218
|
query={query}
|
|
218
219
|
onQuery={(next) => {
|
|
@@ -15,7 +15,7 @@ import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
|
15
15
|
import { RecipeFavoriteCell } from '@terrafirmagreg-team/recipe/components/views/browser/item-panel-grid/favorite-cell';
|
|
16
16
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
17
17
|
import type { EntrySize } from '@terrafirmagreg-team/game/types/entry';
|
|
18
|
-
import type { FavoriteHoverTarget } from '@terrafirmagreg-team/recipe/lib/favorite-hover';
|
|
18
|
+
import type { FavoriteHoverTarget } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
19
19
|
import type { ItemPanelCell, RecipeHrefOpts } from '@terrafirmagreg-team/recipe/types';
|
|
20
20
|
|
|
21
21
|
function PanelChip({
|
|
@@ -8,7 +8,7 @@ import { useMountLimit } from '@terrafirmagreg-team/recipe/hooks/use-mount-limit
|
|
|
8
8
|
import { useGroupOutlines } from '@terrafirmagreg-team/recipe/hooks/use-group-outlines';
|
|
9
9
|
import { Skeleton } from '@terrafirmagreg-team/ui/components/ui/skeleton';
|
|
10
10
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
11
|
-
import type { FavoriteHoverTarget } from '@terrafirmagreg-team/recipe/lib/favorite-hover';
|
|
11
|
+
import type { FavoriteHoverTarget } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
12
12
|
import type { ItemPanelCell, RecipeHrefOpts } from '@terrafirmagreg-team/recipe/types';
|
|
13
13
|
|
|
14
14
|
const CELL = 36;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useMemo, useRef } from 'react';
|
|
4
4
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
5
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
5
6
|
import { RecipeFrame } from '@terrafirmagreg-team/recipe/components/views/browser/frame';
|
|
6
7
|
import { ItemViewHeader } from '@terrafirmagreg-team/recipe/components/views/browser/item-view-header';
|
|
7
8
|
import {
|
|
@@ -35,6 +36,7 @@ import type {
|
|
|
35
36
|
|
|
36
37
|
export function ItemView({ session }: { session: RecipeSession }) {
|
|
37
38
|
const t = useTranslations();
|
|
39
|
+
const resolved = useResolvedLang();
|
|
38
40
|
const {
|
|
39
41
|
dataset,
|
|
40
42
|
lang,
|
|
@@ -63,7 +65,6 @@ export function ItemView({ session }: { session: RecipeSession }) {
|
|
|
63
65
|
const tags = useItemTagGroups({ dataset, index, item, kind });
|
|
64
66
|
const pane = useItemPane({
|
|
65
67
|
dataset,
|
|
66
|
-
lang,
|
|
67
68
|
nav,
|
|
68
69
|
relation,
|
|
69
70
|
recipeId,
|
|
@@ -110,13 +111,13 @@ export function ItemView({ session }: { session: RecipeSession }) {
|
|
|
110
111
|
const row = typeFilter.rows[focusIndex + dir];
|
|
111
112
|
if (focusIndex < 0 || !row) return;
|
|
112
113
|
replaceUrlState(
|
|
113
|
-
recipeHref(dataset,
|
|
114
|
+
recipeHref(dataset, resolved, { ...nav, id: row.id, rpage: undefined }),
|
|
114
115
|
);
|
|
115
116
|
return;
|
|
116
117
|
}
|
|
117
118
|
if (list.pages <= 1) return;
|
|
118
119
|
replaceUrlState(
|
|
119
|
-
recipeHref(dataset,
|
|
120
|
+
recipeHref(dataset, resolved, {
|
|
120
121
|
...nav,
|
|
121
122
|
rpage: (list.page + dir + list.pages) % list.pages,
|
|
122
123
|
}),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
3
3
|
|
|
4
4
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
5
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
5
6
|
import { EmptyState } from '@terrafirmagreg-team/ui/components/blocks/page/empty-state';
|
|
6
7
|
import { LinkPreview } from '@terrafirmagreg-team/ui/components/blocks/link/link-preview';
|
|
7
8
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
@@ -27,6 +28,7 @@ export function ItemTagGroups({
|
|
|
27
28
|
nav: RecipeHrefOpts;
|
|
28
29
|
}) {
|
|
29
30
|
const t = useTranslations();
|
|
31
|
+
const resolved = useResolvedLang();
|
|
30
32
|
if (!groups.length) {
|
|
31
33
|
return <EmptyState variant="empty">{t('No tags for this item.', { note: 'recipe.empty_tags' })}</EmptyState>;
|
|
32
34
|
}
|
|
@@ -47,7 +49,7 @@ export function ItemTagGroups({
|
|
|
47
49
|
return (
|
|
48
50
|
<LinkPreview
|
|
49
51
|
key={`${tagKind}:${id}`}
|
|
50
|
-
href={recipeHref(dataset,
|
|
52
|
+
href={recipeHref(dataset, resolved, {
|
|
51
53
|
type: 'emi:tag',
|
|
52
54
|
id: tagPseudoId(id, tagKind),
|
|
53
55
|
search: query || undefined,
|
|
@@ -65,7 +67,7 @@ export function ItemTagGroups({
|
|
|
65
67
|
? text || token
|
|
66
68
|
: `${text} ${token}`;
|
|
67
69
|
replaceUrlState(
|
|
68
|
-
recipeHref(dataset,
|
|
70
|
+
recipeHref(dataset, resolved, {
|
|
69
71
|
type: 'emi:tag',
|
|
70
72
|
search,
|
|
71
73
|
}),
|
|
@@ -10,20 +10,18 @@ import {
|
|
|
10
10
|
} from '@terrafirmagreg-team/ui/components/ui/input-group';
|
|
11
11
|
import { Pager } from '@terrafirmagreg-team/ui/components/blocks/page/pager';
|
|
12
12
|
import { recipeHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
13
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
13
14
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
14
15
|
import { cn } from '@terrafirmagreg-team/ui/lib/utils/cn';
|
|
15
|
-
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
16
16
|
import type { RecipeHrefOpts } from '@terrafirmagreg-team/recipe/types';
|
|
17
17
|
|
|
18
18
|
type QueryNav = {
|
|
19
19
|
dataset: DatasetRef;
|
|
20
|
-
lang: Lang;
|
|
21
20
|
params?: RecipeHrefOpts;
|
|
22
21
|
};
|
|
23
22
|
|
|
24
23
|
export function QuerySearch({
|
|
25
24
|
dataset,
|
|
26
|
-
lang,
|
|
27
25
|
params,
|
|
28
26
|
query,
|
|
29
27
|
onQuery,
|
|
@@ -35,6 +33,7 @@ export function QuerySearch({
|
|
|
35
33
|
placeholder?: string;
|
|
36
34
|
className?: string;
|
|
37
35
|
}) {
|
|
36
|
+
const resolved = useResolvedLang();
|
|
38
37
|
return (
|
|
39
38
|
<InputGroup className={cn('w-full', className)}>
|
|
40
39
|
<InputGroupAddon>
|
|
@@ -48,7 +47,7 @@ export function QuerySearch({
|
|
|
48
47
|
const next = event.target.value;
|
|
49
48
|
onQuery(next);
|
|
50
49
|
replaceUrlState(
|
|
51
|
-
recipeHref(dataset,
|
|
50
|
+
recipeHref(dataset, resolved, {
|
|
52
51
|
...params,
|
|
53
52
|
search: next || undefined,
|
|
54
53
|
}),
|
|
@@ -61,7 +60,6 @@ export function QuerySearch({
|
|
|
61
60
|
|
|
62
61
|
export function QueryPager({
|
|
63
62
|
dataset,
|
|
64
|
-
lang,
|
|
65
63
|
params,
|
|
66
64
|
query,
|
|
67
65
|
list,
|
|
@@ -81,6 +79,7 @@ export function QueryPager({
|
|
|
81
79
|
leading?: ReactNode;
|
|
82
80
|
className?: string;
|
|
83
81
|
}) {
|
|
82
|
+
const resolved = useResolvedLang();
|
|
84
83
|
return (
|
|
85
84
|
<Pager
|
|
86
85
|
page={list.page}
|
|
@@ -92,7 +91,7 @@ export function QueryPager({
|
|
|
92
91
|
className={className}
|
|
93
92
|
onPage={(next) =>
|
|
94
93
|
replaceUrlState(
|
|
95
|
-
recipeHref(dataset,
|
|
94
|
+
recipeHref(dataset, resolved, {
|
|
96
95
|
...params,
|
|
97
96
|
search: query || undefined,
|
|
98
97
|
rpage: next + 1,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect, useRef } from 'react';
|
|
4
4
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
5
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
5
6
|
import { useAsyncResult, useAsyncValue } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
6
7
|
import { RecipeFrame } from '@terrafirmagreg-team/recipe/components/views/browser/frame';
|
|
7
8
|
import {
|
|
@@ -29,9 +30,9 @@ const EMPTY_ROWS: RecipeCompactRow[] = [];
|
|
|
29
30
|
|
|
30
31
|
export function TypeView({ session }: { session: RecipeSession }) {
|
|
31
32
|
const t = useTranslations();
|
|
33
|
+
const resolved = useResolvedLang();
|
|
32
34
|
const {
|
|
33
35
|
dataset,
|
|
34
|
-
lang,
|
|
35
36
|
index,
|
|
36
37
|
indexLoading,
|
|
37
38
|
place,
|
|
@@ -82,14 +83,14 @@ export function TypeView({ session }: { session: RecipeSession }) {
|
|
|
82
83
|
const row = focusRes.value?.[0];
|
|
83
84
|
const category = row ? index.types[row.type] : undefined;
|
|
84
85
|
replaceUrlState(
|
|
85
|
-
recipeHref(dataset,
|
|
86
|
+
recipeHref(dataset, resolved, {
|
|
86
87
|
...nav,
|
|
87
88
|
...(category && category !== shown ? { type: category } : {}),
|
|
88
89
|
...(category ? {} : { id: undefined }),
|
|
89
90
|
rpage: undefined,
|
|
90
91
|
}),
|
|
91
92
|
);
|
|
92
|
-
}, [focusIndex, focusRes.pending, focusRes.value, index, nav, dataset,
|
|
93
|
+
}, [focusIndex, focusRes.pending, focusRes.value, index, nav, dataset, resolved, recipeId, rows, shown]);
|
|
93
94
|
const list = useFitPages(
|
|
94
95
|
boxRef,
|
|
95
96
|
feedRows,
|
|
@@ -109,13 +110,13 @@ export function TypeView({ session }: { session: RecipeSession }) {
|
|
|
109
110
|
const row = allRows[next];
|
|
110
111
|
if (focusIndex < 0 || !row) return;
|
|
111
112
|
replaceUrlState(
|
|
112
|
-
recipeHref(dataset,
|
|
113
|
+
recipeHref(dataset, resolved, { ...nav, id: row.id, rpage: undefined }),
|
|
113
114
|
);
|
|
114
115
|
return;
|
|
115
116
|
}
|
|
116
117
|
if (list.pages <= 1) return;
|
|
117
118
|
replaceUrlState(
|
|
118
|
-
recipeHref(dataset,
|
|
119
|
+
recipeHref(dataset, resolved, {
|
|
119
120
|
...nav,
|
|
120
121
|
rpage: (list.page + dir + list.pages) % list.pages,
|
|
121
122
|
}),
|
|
@@ -154,7 +155,7 @@ export function TypeView({ session }: { session: RecipeSession }) {
|
|
|
154
155
|
onChange={(id) => {
|
|
155
156
|
if (id === shown) return;
|
|
156
157
|
replaceUrlState(
|
|
157
|
-
recipeHref(dataset,
|
|
158
|
+
recipeHref(dataset, resolved, {
|
|
158
159
|
...nav,
|
|
159
160
|
type: id,
|
|
160
161
|
id: undefined,
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@terrafirmagreg-team/ui/lib/canvas/edge';
|
|
13
13
|
import { Entry } from '@terrafirmagreg-team/game/components/entry/entry';
|
|
14
14
|
import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
15
|
-
import { useCalcSession } from '@terrafirmagreg-team/recipe/hooks/calc/use-session';
|
|
15
|
+
import { useCalcSession } from '@terrafirmagreg-team/recipe/hooks/calc/use-calc-session';
|
|
16
16
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
17
17
|
import { formatCount } from '@terrafirmagreg-team/ui/lib/utils/format';
|
|
18
18
|
import type { FlowPoint } from '@terrafirmagreg-team/ui/types/canvas';
|
|
@@ -26,7 +26,7 @@ import { CalcNodeCard } from '@terrafirmagreg-team/recipe/components/views/calc/
|
|
|
26
26
|
import { CalcDotOverlay } from '@terrafirmagreg-team/recipe/components/views/calc/dot-overlay';
|
|
27
27
|
import { EmptyState } from '@terrafirmagreg-team/ui/components/blocks/page/empty-state';
|
|
28
28
|
import { CalcEdge } from '@terrafirmagreg-team/recipe/components/views/calc/edge';
|
|
29
|
-
import { CalcSessionProvider } from '@terrafirmagreg-team/recipe/hooks/calc/use-session';
|
|
29
|
+
import { CalcSessionProvider } from '@terrafirmagreg-team/recipe/hooks/calc/use-calc-session';
|
|
30
30
|
import { CalcFarProvider } from '@terrafirmagreg-team/recipe/hooks/calc/use-far-mode';
|
|
31
31
|
import { CalcTierProvider } from '@terrafirmagreg-team/recipe/hooks/calc/use-tier';
|
|
32
32
|
import { useFlowPickers } from '@terrafirmagreg-team/recipe/hooks/calc/flow/use-pickers';
|
|
@@ -8,7 +8,7 @@ import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-transl
|
|
|
8
8
|
import { StackCount } from '@terrafirmagreg-team/game/components/entry/stack-count';
|
|
9
9
|
import { PagedCard } from '@terrafirmagreg-team/recipe/components/cards/paged-card';
|
|
10
10
|
import { Skeleton } from '@terrafirmagreg-team/ui/components/ui/skeleton';
|
|
11
|
-
import { useCalcSession } from '@terrafirmagreg-team/recipe/hooks/calc/use-session';
|
|
11
|
+
import { useCalcSession } from '@terrafirmagreg-team/recipe/hooks/calc/use-calc-session';
|
|
12
12
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
13
13
|
import {
|
|
14
14
|
recipeCardImageUrl,
|
|
@@ -19,7 +19,7 @@ import { Entry } from '@terrafirmagreg-team/game/components/entry/entry';
|
|
|
19
19
|
import { StackCount } from '@terrafirmagreg-team/game/components/entry/stack-count';
|
|
20
20
|
import { PagedCard } from '@terrafirmagreg-team/recipe/components/cards/paged-card';
|
|
21
21
|
import { Skeleton } from '@terrafirmagreg-team/ui/components/ui/skeleton';
|
|
22
|
-
import { useCalcSession } from '@terrafirmagreg-team/recipe/hooks/calc/use-session';
|
|
22
|
+
import { useCalcSession } from '@terrafirmagreg-team/recipe/hooks/calc/use-calc-session';
|
|
23
23
|
import { useCalcFar } from '@terrafirmagreg-team/recipe/hooks/calc/use-far-mode';
|
|
24
24
|
import { useCalcTier } from '@terrafirmagreg-team/recipe/hooks/calc/use-tier';
|
|
25
25
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Suspense } from 'react';
|
|
2
|
+
import { WorkspaceBody } from '@terrafirmagreg-team/ui/components/layouts/workspace';
|
|
3
|
+
import type {
|
|
4
|
+
SectionLandingProps,
|
|
5
|
+
SectionLandingView,
|
|
6
|
+
} from '@terrafirmagreg-team/kit/components/views/routes';
|
|
7
|
+
import type { RecipeSource } from '@terrafirmagreg-team/recipe/lib/source';
|
|
8
|
+
import {
|
|
9
|
+
RecipeBrowser,
|
|
10
|
+
RecipeBrowserFallback,
|
|
11
|
+
} from '@terrafirmagreg-team/recipe/components/views/browser';
|
|
12
|
+
|
|
13
|
+
export function recipeLanding({
|
|
14
|
+
page,
|
|
15
|
+
lang,
|
|
16
|
+
}: SectionLandingProps<RecipeSource>): SectionLandingView {
|
|
17
|
+
return {
|
|
18
|
+
node: (
|
|
19
|
+
<WorkspaceBody className="viewport-body">
|
|
20
|
+
<Suspense fallback={<RecipeBrowserFallback />}>
|
|
21
|
+
<RecipeBrowser
|
|
22
|
+
dataset={page.dataset.id}
|
|
23
|
+
datasetTitle={page.datasetTitle ?? page.dataset.id}
|
|
24
|
+
lang={lang}
|
|
25
|
+
versions={page.versions}
|
|
26
|
+
/>
|
|
27
|
+
</Suspense>
|
|
28
|
+
</WorkspaceBody>
|
|
29
|
+
),
|
|
30
|
+
workspace: { full: true, pagination: false },
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Layout } from '@terrafirmagreg-team/kit/components/layouts/layout';
|
|
2
|
+
import type { SectionLayoutViewProps } from '@terrafirmagreg-team/kit/components/views/routes';
|
|
3
|
+
import { RecipeAxisSwitcher } from '@terrafirmagreg-team/recipe/components/views/browser/axis-switcher';
|
|
4
|
+
import { useRecipeLeftSidebarTree } from '@terrafirmagreg-team/recipe/hooks/use-left-sidebar-tree';
|
|
5
|
+
|
|
6
|
+
export function RecipeLayout(props: SectionLayoutViewProps) {
|
|
7
|
+
return (
|
|
8
|
+
<Layout
|
|
9
|
+
{...props}
|
|
10
|
+
useTree={useRecipeLeftSidebarTree}
|
|
11
|
+
sidebar={{ feature: RecipeAxisSwitcher }}
|
|
12
|
+
/>
|
|
13
|
+
);
|
|
14
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
5
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
5
6
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
6
7
|
import { recipeItemName } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
7
8
|
import { useFluidColors } from '@terrafirmagreg-team/recipe/hooks/alloy/use-fluid-colors';
|
|
@@ -92,10 +93,11 @@ export function useMixState(recipe: AlloyRecipe, session: RecipeSession) {
|
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
96
|
+
const resolved = useResolvedLang();
|
|
95
97
|
useEffect(() => {
|
|
96
98
|
const mix = amounts.map((value) => trim(value)).join(';');
|
|
97
99
|
replaceUrlState(
|
|
98
|
-
recipeHref(session.dataset,
|
|
100
|
+
recipeHref(session.dataset, resolved, {
|
|
99
101
|
tool: 'alloy',
|
|
100
102
|
id: recipe.recipe.id,
|
|
101
103
|
tab: session.tab,
|
|
@@ -108,7 +110,7 @@ export function useMixState(recipe: AlloyRecipe, session: RecipeSession) {
|
|
|
108
110
|
amounts,
|
|
109
111
|
recipe.recipe.id,
|
|
110
112
|
session.dataset,
|
|
111
|
-
|
|
113
|
+
resolved,
|
|
112
114
|
session.tab,
|
|
113
115
|
]);
|
|
114
116
|
const mix = useMemo(
|
|
@@ -21,13 +21,12 @@ import { useCalcResolver } from './use-resolver';
|
|
|
21
21
|
import { useRecipeDefaults } from './use-defaults';
|
|
22
22
|
|
|
23
23
|
export function useCalcData(session: RecipeSession) {
|
|
24
|
-
const { dataset
|
|
24
|
+
const { dataset } = session;
|
|
25
25
|
const catalog = session.index;
|
|
26
26
|
const storageKey = calcStorageKey('recipe', dataset);
|
|
27
27
|
const sharePending = useCalcShare({
|
|
28
28
|
storageKey,
|
|
29
29
|
dataset,
|
|
30
|
-
lang,
|
|
31
30
|
incoming: session.tree ?? '',
|
|
32
31
|
});
|
|
33
32
|
const {
|
|
@@ -8,18 +8,17 @@ import {
|
|
|
8
8
|
writeCalcTabs,
|
|
9
9
|
} from '@terrafirmagreg-team/recipe/lib/calc/storage';
|
|
10
10
|
import { recipeCalcHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
11
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
11
12
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
12
13
|
import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
13
14
|
|
|
14
15
|
export function useCalcShare({
|
|
15
16
|
storageKey,
|
|
16
17
|
dataset,
|
|
17
|
-
lang,
|
|
18
18
|
incoming,
|
|
19
19
|
}: {
|
|
20
20
|
storageKey: string;
|
|
21
21
|
dataset: DatasetRef;
|
|
22
|
-
lang: string;
|
|
23
22
|
incoming: string;
|
|
24
23
|
}): boolean {
|
|
25
24
|
const isShareId = incoming.startsWith('s');
|
|
@@ -44,6 +43,7 @@ export function useCalcShare({
|
|
|
44
43
|
};
|
|
45
44
|
}, [isShareId, incoming, dataset]);
|
|
46
45
|
const transport = isShareId ? sharedTree : incoming || null;
|
|
46
|
+
const resolved = useResolvedLang();
|
|
47
47
|
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
if (transport === null) return;
|
|
@@ -56,8 +56,8 @@ export function useCalcShare({
|
|
|
56
56
|
entry.id,
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
|
-
if (incoming) replaceUrlState(recipeCalcHref(dataset,
|
|
60
|
-
}, [transport, storageKey, dataset,
|
|
59
|
+
if (incoming) replaceUrlState(recipeCalcHref(dataset, resolved));
|
|
60
|
+
}, [transport, storageKey, dataset, resolved, incoming]);
|
|
61
61
|
|
|
62
62
|
return isShareId && sharedTree === null;
|
|
63
63
|
}
|
|
@@ -6,11 +6,13 @@ import {
|
|
|
6
6
|
encodeCalcState,
|
|
7
7
|
} from '@terrafirmagreg-team/recipe/lib/calc/tree';
|
|
8
8
|
import { recipeCalcHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
9
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
9
10
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
10
11
|
import type { RecipeSession } from '@terrafirmagreg-team/recipe/types';
|
|
11
12
|
|
|
12
13
|
export function useAddToCalc(session: RecipeSession) {
|
|
13
|
-
const { dataset,
|
|
14
|
+
const { dataset, tree } = session;
|
|
15
|
+
const resolved = useResolvedLang();
|
|
14
16
|
return useCallback(
|
|
15
17
|
(item: string, kind: 'item' | 'fluid') => {
|
|
16
18
|
const state = decodeCalcState(tree ?? '') ?? {
|
|
@@ -40,12 +42,12 @@ export function useAddToCalc(session: RecipeSession) {
|
|
|
40
42
|
replaceUrlState(
|
|
41
43
|
recipeCalcHref(
|
|
42
44
|
dataset,
|
|
43
|
-
|
|
45
|
+
resolved,
|
|
44
46
|
encodeCalcState({ ...state, cards }),
|
|
45
47
|
),
|
|
46
48
|
);
|
|
47
49
|
},
|
|
48
|
-
[tree, dataset,
|
|
50
|
+
[tree, dataset, resolved],
|
|
49
51
|
);
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { useFavorites } from '@terrafirmagreg-team/recipe/hooks/use-favorites';
|
|
5
|
-
import { favoriteHoverTarget } from '@terrafirmagreg-team/recipe/lib/favorite-hover';
|
|
5
|
+
import { favoriteHoverTarget } from '@terrafirmagreg-team/recipe/lib/browser/favorite-hover';
|
|
6
6
|
|
|
7
7
|
export function useFavoriteHotkey() {
|
|
8
8
|
const { toggleItem, toggleRecipe } = useFavorites();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
-
import { groupOutlines } from '@terrafirmagreg-team/recipe/lib/panel-outline';
|
|
4
|
+
import { groupOutlines } from '@terrafirmagreg-team/recipe/lib/browser/panel-outline';
|
|
5
5
|
import type { ItemPanelCell } from '@terrafirmagreg-team/recipe/types';
|
|
6
6
|
|
|
7
7
|
const CELL = 36;
|
package/src/hooks/use-index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
loadRecipeCompactIndex,
|
|
10
10
|
loadRecipeSkeletonIndex,
|
|
11
11
|
} from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
12
|
-
import { publishRecipeIndex } from '@terrafirmagreg-team/recipe/lib/index
|
|
12
|
+
import { publishRecipeIndex } from '@terrafirmagreg-team/recipe/lib/client-index/store';
|
|
13
13
|
import type { RecipeCompactIndex } from '@terrafirmagreg-team/recipe/types';
|
|
14
14
|
|
|
15
15
|
type LoadedIndex = { key: string; index: RecipeCompactIndex };
|
|
@@ -5,7 +5,7 @@ import { useAsyncResult } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
|
5
5
|
import {
|
|
6
6
|
recipesForOutput,
|
|
7
7
|
usesForInput,
|
|
8
|
-
} from '@terrafirmagreg-team/recipe/lib/lookup';
|
|
8
|
+
} from '@terrafirmagreg-team/recipe/lib/browser/lookup';
|
|
9
9
|
import type { RecipeCompactIndex, RecipeCompactRow } from '@terrafirmagreg-team/recipe/types';
|
|
10
10
|
|
|
11
11
|
export const EMPTY_ROWS: RecipeCompactRow[] = [];
|
|
@@ -4,12 +4,12 @@ import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
|
4
4
|
import { createElement, useMemo } from 'react';
|
|
5
5
|
import { ArrowDownToLine, ArrowUpFromLine, Tag } from 'lucide-react';
|
|
6
6
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
7
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
7
8
|
import { usePaneKeys } from '@terrafirmagreg-team/ui/hooks/use-pane-keys';
|
|
8
9
|
import { recipeHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
9
10
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
10
11
|
import { EMPTY_ROWS } from '@terrafirmagreg-team/recipe/hooks/use-item-feeds';
|
|
11
12
|
import type { PaneTabOption } from '@terrafirmagreg-team/recipe/components/views/browser/pane-tabs';
|
|
12
|
-
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
13
13
|
import type {
|
|
14
14
|
RecipeCompactRow,
|
|
15
15
|
RecipeHrefOpts,
|
|
@@ -23,7 +23,6 @@ const inFeed = (id: string | undefined, rows: RecipeCompactRow[] | undefined) =>
|
|
|
23
23
|
|
|
24
24
|
export function useItemPane({
|
|
25
25
|
dataset,
|
|
26
|
-
lang,
|
|
27
26
|
nav,
|
|
28
27
|
relation,
|
|
29
28
|
recipeId,
|
|
@@ -33,7 +32,6 @@ export function useItemPane({
|
|
|
33
32
|
feedsPending,
|
|
34
33
|
}: {
|
|
35
34
|
dataset: DatasetRef;
|
|
36
|
-
lang: Lang;
|
|
37
35
|
nav: RecipeHrefOpts;
|
|
38
36
|
relation?: RecipeRelation;
|
|
39
37
|
recipeId?: string;
|
|
@@ -43,6 +41,7 @@ export function useItemPane({
|
|
|
43
41
|
feedsPending: boolean;
|
|
44
42
|
}) {
|
|
45
43
|
const t = useTranslations();
|
|
44
|
+
const resolved = useResolvedLang();
|
|
46
45
|
const available = {
|
|
47
46
|
recipes: (recipes ?? EMPTY_ROWS).length > 0,
|
|
48
47
|
uses: (uses ?? EMPTY_ROWS).length > 0,
|
|
@@ -60,7 +59,7 @@ export function useItemPane({
|
|
|
60
59
|
relation && (feedsPending || available[relation]) ? relation : fallback;
|
|
61
60
|
const select = (next: ItemPane) => {
|
|
62
61
|
replaceUrlState(
|
|
63
|
-
recipeHref(dataset,
|
|
62
|
+
recipeHref(dataset, resolved, {
|
|
64
63
|
...nav,
|
|
65
64
|
relation: next === 'recipes' ? undefined : next,
|
|
66
65
|
rpage: undefined,
|
|
@@ -9,21 +9,20 @@ import {
|
|
|
9
9
|
} from '@terrafirmagreg-team/recipe/lib/calc/storage';
|
|
10
10
|
import { requestCalcFocus } from '@terrafirmagreg-team/recipe/lib/calc/focus';
|
|
11
11
|
import { recipeHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
12
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
12
13
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
13
|
-
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
14
14
|
import type { RecipeHrefOpts } from '@terrafirmagreg-team/recipe/types';
|
|
15
15
|
|
|
16
16
|
export function useItemPress({
|
|
17
17
|
dataset,
|
|
18
|
-
lang,
|
|
19
18
|
nav,
|
|
20
19
|
isCalc,
|
|
21
20
|
}: {
|
|
22
21
|
dataset: DatasetRef;
|
|
23
|
-
lang: Lang;
|
|
24
22
|
nav: RecipeHrefOpts;
|
|
25
23
|
isCalc: boolean;
|
|
26
24
|
}) {
|
|
25
|
+
const resolved = useResolvedLang();
|
|
27
26
|
const pressRef = useRef<(id: string, ref?: 'item' | 'fluid') => void>(
|
|
28
27
|
() => {},
|
|
29
28
|
);
|
|
@@ -67,7 +66,7 @@ export function useItemPress({
|
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
68
|
replaceUrlState(
|
|
70
|
-
recipeHref(dataset,
|
|
69
|
+
recipeHref(dataset, resolved, {
|
|
71
70
|
...nav,
|
|
72
71
|
type: undefined,
|
|
73
72
|
tool: undefined,
|
|
@@ -4,7 +4,7 @@ import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { useAsyncValue } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
6
6
|
import { loadTagSlice } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
7
|
-
import { registryId } from '@terrafirmagreg-team/recipe/lib/lookup';
|
|
7
|
+
import { registryId } from '@terrafirmagreg-team/recipe/lib/browser/lookup';
|
|
8
8
|
import { splitDumpId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
9
9
|
import type { RecipeCompactIndex } from '@terrafirmagreg-team/recipe/types';
|
|
10
10
|
|
|
@@ -7,7 +7,7 @@ import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolv
|
|
|
7
7
|
import { useLastValue } from '@terrafirmagreg-team/ui/hooks/use-last-value';
|
|
8
8
|
import { useRecipeModNames } from '@terrafirmagreg-team/recipe/hooks/use-mod-names';
|
|
9
9
|
import { useSidebarGroup } from '@terrafirmagreg-team/recipe/hooks/use-sidebar-group';
|
|
10
|
-
import { groupRecipeSidebarByMod } from '@terrafirmagreg-team/recipe/lib/sidebar';
|
|
10
|
+
import { groupRecipeSidebarByMod } from '@terrafirmagreg-team/recipe/lib/browser/sidebar';
|
|
11
11
|
import { parseSectionLocation } from '@terrafirmagreg-team/sites/location';
|
|
12
12
|
|
|
13
13
|
export function useRecipeLeftSidebarTree(tree: PageTree.Root): PageTree.Root {
|
|
@@ -4,17 +4,17 @@ import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
|
4
4
|
import { useDeferredValue, useMemo } from 'react';
|
|
5
5
|
import { useItemTooltips } from '@terrafirmagreg-team/recipe/hooks/use-item-tooltips';
|
|
6
6
|
import { useTagMembers } from '@terrafirmagreg-team/recipe/hooks/use-tag-members';
|
|
7
|
-
import { filterCatalogItemIds } from '@terrafirmagreg-team/recipe/lib/search';
|
|
7
|
+
import { filterCatalogItemIds } from '@terrafirmagreg-team/recipe/lib/search/index';
|
|
8
8
|
import {
|
|
9
9
|
buildPanelCells,
|
|
10
10
|
panelPool,
|
|
11
11
|
type ItemPanelMode,
|
|
12
|
-
} from '@terrafirmagreg-team/recipe/lib/panel';
|
|
12
|
+
} from '@terrafirmagreg-team/recipe/lib/browser/panel';
|
|
13
13
|
import {
|
|
14
14
|
filterUsedIds,
|
|
15
15
|
hasRecipeUsage,
|
|
16
16
|
recipeUsedItems,
|
|
17
|
-
} from '@terrafirmagreg-team/recipe/lib/used-items';
|
|
17
|
+
} from '@terrafirmagreg-team/recipe/lib/browser/used-items';
|
|
18
18
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
19
19
|
import type {
|
|
20
20
|
FavoriteEntry,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { createElement, useMemo } from 'react';
|
|
4
4
|
import { Entry } from '@terrafirmagreg-team/game/components/entry/entry';
|
|
5
5
|
import { useTranslations } from '@terrafirmagreg-team/translate/hooks/use-translations';
|
|
6
|
-
import { panelTabRows } from '@terrafirmagreg-team/recipe/lib/panel';
|
|
6
|
+
import { panelTabRows } from '@terrafirmagreg-team/recipe/lib/browser/panel';
|
|
7
7
|
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
8
8
|
import type { RecipeCompactIndex } from '@terrafirmagreg-team/recipe/types';
|
|
9
9
|
|
package/src/hooks/use-query.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
|
3
3
|
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { useLocationSearchParams } from '@terrafirmagreg-team/ui/hooks/page/use-location-search';
|
|
6
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
6
7
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
7
8
|
import {
|
|
8
9
|
recipeCalcHref,
|
|
@@ -10,7 +11,6 @@ import {
|
|
|
10
11
|
recipePlaceFromParams,
|
|
11
12
|
} from '@terrafirmagreg-team/recipe/lib/links';
|
|
12
13
|
import { canonicalStackId } from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
13
|
-
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
14
14
|
import type { RecipeRelation } from '@terrafirmagreg-team/recipe/types';
|
|
15
15
|
|
|
16
16
|
function urlPage(params: URLSearchParams, key: string) {
|
|
@@ -25,8 +25,9 @@ function urlRelation(
|
|
|
25
25
|
return value === 'uses' || value === 'tags' ? value : undefined;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export function useRecipeQuery(dataset: DatasetRef
|
|
28
|
+
export function useRecipeQuery(dataset: DatasetRef) {
|
|
29
29
|
const params = useLocationSearchParams();
|
|
30
|
+
const resolved = useResolvedLang();
|
|
30
31
|
|
|
31
32
|
const place = recipePlaceFromParams(params);
|
|
32
33
|
const isCalc = place.kind === 'calc';
|
|
@@ -79,8 +80,8 @@ export function useRecipeQuery(dataset: DatasetRef, lang: Lang) {
|
|
|
79
80
|
if (!stray) return;
|
|
80
81
|
replaceUrlState(
|
|
81
82
|
isCalc
|
|
82
|
-
? recipeCalcHref(dataset,
|
|
83
|
-
: recipeHref(dataset,
|
|
83
|
+
? recipeCalcHref(dataset, resolved, tree || undefined)
|
|
84
|
+
: recipeHref(dataset, resolved, {
|
|
84
85
|
tool: place.kind,
|
|
85
86
|
id: recipeId,
|
|
86
87
|
unit: alloyUnit,
|
|
@@ -92,7 +93,7 @@ export function useRecipeQuery(dataset: DatasetRef, lang: Lang) {
|
|
|
92
93
|
isTool,
|
|
93
94
|
isCalc,
|
|
94
95
|
place.kind,
|
|
95
|
-
|
|
96
|
+
resolved,
|
|
96
97
|
dataset,
|
|
97
98
|
params,
|
|
98
99
|
tree,
|
|
@@ -107,7 +108,7 @@ export function useRecipeQuery(dataset: DatasetRef, lang: Lang) {
|
|
|
107
108
|
if (isTool) return;
|
|
108
109
|
if (rawItem && rawFluid) {
|
|
109
110
|
replaceUrlState(
|
|
110
|
-
recipeHref(dataset,
|
|
111
|
+
recipeHref(dataset, resolved, {
|
|
111
112
|
type: params.get('type') ?? undefined,
|
|
112
113
|
item: rawItem,
|
|
113
114
|
id: recipeId,
|
|
@@ -121,7 +122,7 @@ export function useRecipeQuery(dataset: DatasetRef, lang: Lang) {
|
|
|
121
122
|
}
|
|
122
123
|
}, [
|
|
123
124
|
isTool,
|
|
124
|
-
|
|
125
|
+
resolved,
|
|
125
126
|
dataset,
|
|
126
127
|
params,
|
|
127
128
|
rawItem,
|
|
@@ -140,7 +141,7 @@ export function useRecipeQuery(dataset: DatasetRef, lang: Lang) {
|
|
|
140
141
|
const canonFluid = rawFluid ? canonicalStackId(rawFluid) : undefined;
|
|
141
142
|
if (canonItem === rawItem && canonFluid === rawFluid) return;
|
|
142
143
|
replaceUrlState(
|
|
143
|
-
recipeHref(dataset,
|
|
144
|
+
recipeHref(dataset, resolved, {
|
|
144
145
|
type: params.get('type') ?? undefined,
|
|
145
146
|
item: canonItem,
|
|
146
147
|
fluid: canonFluid,
|
|
@@ -154,7 +155,7 @@ export function useRecipeQuery(dataset: DatasetRef, lang: Lang) {
|
|
|
154
155
|
);
|
|
155
156
|
}, [
|
|
156
157
|
isTool,
|
|
157
|
-
|
|
158
|
+
resolved,
|
|
158
159
|
dataset,
|
|
159
160
|
params,
|
|
160
161
|
rawItem,
|
package/src/hooks/use-session.ts
CHANGED
|
@@ -5,14 +5,15 @@ import { useVersionedDataset } from '@terrafirmagreg-team/kit/hooks/use-versione
|
|
|
5
5
|
import { useRecipeIndex } from '@terrafirmagreg-team/recipe/hooks/use-index';
|
|
6
6
|
import { useRecipeQuery } from '@terrafirmagreg-team/recipe/hooks/use-query';
|
|
7
7
|
import { useAsyncValue } from '@terrafirmagreg-team/ui/hooks/use-async-value';
|
|
8
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
8
9
|
import { clientDumpLang } from '@terrafirmagreg-team/dump/lib/dump/client/dump';
|
|
9
|
-
import { useRecipeIndexNames } from '@terrafirmagreg-team/recipe/lib/index
|
|
10
|
+
import { useRecipeIndexNames } from '@terrafirmagreg-team/recipe/lib/client-index/store';
|
|
10
11
|
import {
|
|
11
12
|
RECIPE_ALL_TYPE,
|
|
12
13
|
recipeHref,
|
|
13
14
|
recipePlaceOpts,
|
|
14
15
|
} from '@terrafirmagreg-team/recipe/lib/links';
|
|
15
|
-
import { recipeUsedItems } from '@terrafirmagreg-team/recipe/lib/used-items';
|
|
16
|
+
import { recipeUsedItems } from '@terrafirmagreg-team/recipe/lib/browser/used-items';
|
|
16
17
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
17
18
|
import type {
|
|
18
19
|
RecipeHrefOpts,
|
|
@@ -24,7 +25,7 @@ export function useRecipeSession(page: RecipePageData): RecipeSession {
|
|
|
24
25
|
const { dataset: id, lang } = page;
|
|
25
26
|
const dataset =
|
|
26
27
|
useVersionedDataset(id.id, { versions: page.versions }) ?? id;
|
|
27
|
-
const query = useRecipeQuery(dataset
|
|
28
|
+
const query = useRecipeQuery(dataset);
|
|
28
29
|
const { index, indexLoading } = useRecipeIndex(dataset, lang);
|
|
29
30
|
const placeOpts = recipePlaceOpts(query.place);
|
|
30
31
|
|
|
@@ -65,11 +66,14 @@ export function useRecipeSession(page: RecipePageData): RecipeSession {
|
|
|
65
66
|
query.place.id === RECIPE_ALL_TYPE &&
|
|
66
67
|
!query.item &&
|
|
67
68
|
!query.fluid;
|
|
69
|
+
const resolved = useResolvedLang();
|
|
68
70
|
useEffect(() => {
|
|
69
71
|
if (!bareIndex || !firstType) return;
|
|
70
|
-
replaceUrlState(
|
|
72
|
+
replaceUrlState(
|
|
73
|
+
recipeHref(dataset, resolved, { ...nav, type: firstType }),
|
|
74
|
+
);
|
|
71
75
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- nav rebuilds per render
|
|
72
|
-
}, [bareIndex, firstType, dataset,
|
|
76
|
+
}, [bareIndex, firstType, dataset, resolved]);
|
|
73
77
|
|
|
74
78
|
return {
|
|
75
79
|
page,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { useEffect, useMemo } from 'react';
|
|
4
|
-
import { groupByCategory } from '@terrafirmagreg-team/recipe/lib/group';
|
|
4
|
+
import { groupByCategory } from '@terrafirmagreg-team/recipe/lib/browser/group';
|
|
5
5
|
import { TAG_RECIPE_TYPE } from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
6
6
|
import { RECIPE_ALL_TYPE, recipeHref } from '@terrafirmagreg-team/recipe/lib/links';
|
|
7
|
+
import { useResolvedLang } from '@terrafirmagreg-team/translate/hooks/use-resolved-lang';
|
|
7
8
|
import { replaceUrlState } from '@terrafirmagreg-team/ui/lib/utils/history';
|
|
8
9
|
import type {
|
|
9
10
|
RecipeCompactRow,
|
|
@@ -14,7 +15,6 @@ export function useTypeFilter(
|
|
|
14
15
|
session: Pick<
|
|
15
16
|
RecipeSession,
|
|
16
17
|
| 'dataset'
|
|
17
|
-
| 'lang'
|
|
18
18
|
| 'index'
|
|
19
19
|
| 'nav'
|
|
20
20
|
| 'place'
|
|
@@ -24,7 +24,8 @@ export function useTypeFilter(
|
|
|
24
24
|
>,
|
|
25
25
|
rows: RecipeCompactRow[],
|
|
26
26
|
) {
|
|
27
|
-
const { dataset,
|
|
27
|
+
const { dataset, index, nav, place, recipeId } = session;
|
|
28
|
+
const resolved = useResolvedLang();
|
|
28
29
|
const groups = useMemo(
|
|
29
30
|
() => groupByCategory(rows, index?.types ?? [], index?.categories),
|
|
30
31
|
[rows, index],
|
|
@@ -51,15 +52,15 @@ export function useTypeFilter(
|
|
|
51
52
|
useEffect(() => {
|
|
52
53
|
if (!primary || valid) return;
|
|
53
54
|
replaceUrlState(
|
|
54
|
-
recipeHref(dataset,
|
|
55
|
+
recipeHref(dataset, resolved, { ...nav, type: primary, rpage: undefined }),
|
|
55
56
|
);
|
|
56
57
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- nav rebuilds per render
|
|
57
|
-
}, [primary, valid, dataset,
|
|
58
|
+
}, [primary, valid, dataset, resolved]);
|
|
58
59
|
|
|
59
60
|
const setActive = (next: string) => {
|
|
60
61
|
if (next === active || next === urlType) return;
|
|
61
62
|
replaceUrlState(
|
|
62
|
-
recipeHref(dataset,
|
|
63
|
+
recipeHref(dataset, resolved, { ...nav, type: next, rpage: undefined }),
|
|
63
64
|
);
|
|
64
65
|
};
|
|
65
66
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
resolveRecipeRows,
|
|
11
11
|
} from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
12
12
|
import { stackIdFromRef } from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
13
|
-
import { loadFluidIoIndex } from '@terrafirmagreg-team/recipe/lib/fluid-outputs';
|
|
13
|
+
import { loadFluidIoIndex } from '@terrafirmagreg-team/recipe/lib/browser/fluid-outputs';
|
|
14
14
|
|
|
15
15
|
export { registryId, tagPseudoId } from '@terrafirmagreg-team/dump/lib/dump/paths';
|
|
16
16
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { registryId } from '@terrafirmagreg-team/recipe/lib/lookup';
|
|
1
|
+
import { registryId } from '@terrafirmagreg-team/recipe/lib/browser/lookup';
|
|
2
2
|
import type { RecipeCompactIndex, UsedItems } from '@terrafirmagreg-team/recipe/types';
|
|
3
3
|
|
|
4
4
|
export function recipeUsedItems(index: RecipeCompactIndex | null): UsedItems {
|
package/src/lib/calc/resolve.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
|
2
2
|
import type { Recipe } from '@terrafirmagreg-team/recipe/lib/data/dto';
|
|
3
3
|
import { loadClientRecipe } from '@terrafirmagreg-team/recipe/lib/client/recipe';
|
|
4
4
|
import { resolveClientTag } from '@terrafirmagreg-team/dump/lib/dump/client/tags';
|
|
5
|
-
import { recipesForOutput } from '@terrafirmagreg-team/recipe/lib/lookup';
|
|
5
|
+
import { recipesForOutput } from '@terrafirmagreg-team/recipe/lib/browser/lookup';
|
|
6
6
|
import { recipeDivisor, toCalcRecipe } from './tree';
|
|
7
7
|
import type { RecipeCompactIndex, RecipeCompactRow } from '@terrafirmagreg-team/recipe/types';
|
|
8
8
|
import type {
|
package/src/lib/config.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { createConfigRegistry, uiConfig } from '@terrafirmagreg-team/ui/lib/conf
|
|
|
2
2
|
import { registerMdxComponents } from '@terrafirmagreg-team/mdx/components/mdx-components';
|
|
3
3
|
import { Recipe } from '@terrafirmagreg-team/recipe/components/mdx/recipe';
|
|
4
4
|
import '@terrafirmagreg-team/recipe/lib/preview';
|
|
5
|
+
import '@terrafirmagreg-team/recipe/lib/embed';
|
|
5
6
|
|
|
6
7
|
export type RecipeConfigInput = {
|
|
7
8
|
appName?: string;
|
package/src/lib/embed.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from '@terrafirmagreg-team/recipe/lib/links';
|
|
7
7
|
import { recipeTitle } from '@terrafirmagreg-team/recipe/lib/data/parse';
|
|
8
8
|
import type { Recipe } from '@terrafirmagreg-team/recipe/lib/data/dto';
|
|
9
|
+
import { registerSectionEmbed } from '@terrafirmagreg-team/kit/lib/embeds';
|
|
9
10
|
import type {
|
|
10
11
|
EmbedRecipe,
|
|
11
12
|
SectionEmbeds,
|
|
@@ -20,3 +21,5 @@ export const recipeSectionEmbed: NonNullable<SectionEmbeds['recipe']> = {
|
|
|
20
21
|
recipeTitle(recipe as unknown as Recipe, langMap),
|
|
21
22
|
Card: RecipeEmbedCard,
|
|
22
23
|
};
|
|
24
|
+
|
|
25
|
+
registerSectionEmbed('recipe', recipeSectionEmbed);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as clientIndex from '@terrafirmagreg-team/recipe/lib/client-index';
|
|
2
|
+
import { loadDatasetRecipeCategories } from '@terrafirmagreg-team/recipe/lib/data/category/load';
|
|
3
|
+
import { loadClientManifest } from '@terrafirmagreg-team/dump/lib/dump/client/dump';
|
|
4
|
+
|
|
5
|
+
export function getRecipeSource() {
|
|
6
|
+
return {
|
|
7
|
+
...clientIndex,
|
|
8
|
+
categories: loadDatasetRecipeCategories,
|
|
9
|
+
manifest: loadClientManifest,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type RecipeSource = ReturnType<typeof getRecipeSource>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|