Skip to content

Commit adeee69

Browse files
committed
PR preview + mock library loader
1 parent 4bde6a3 commit adeee69

4 files changed

Lines changed: 36 additions & 2 deletions

File tree

.github/workflows/preview.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Deploy PR Preview
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, closed]
5+
6+
jobs:
7+
preview:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version: "22"
14+
- run: yarn
15+
- run: yarn build:web
16+
- uses: rossjrw/pr-preview-action@v1
17+
with:
18+
source-dir: ./packages/raga-web-app/dist

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
],
88
"scripts": {
99
"build": "nx run-many -t build",
10+
"build:web": "yarn workspace @adahiya/raga-lib build && yarn workspace @adahiya/raga-web-app build",
1011
"check-format": "prettier --check \"./**/*.{js,json,md,scss,ts,tsx,yaml,yml}\"",
1112
"check-lint": "nx run-many -t check-lint",
1213
"check-types": "nx run-many -t check-types",

packages/raga-web-app/src/components/library/libraryLoader.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ import { useTaskEffect } from "../../hooks";
55
import { appStore } from "../../store/appStore";
66
import EmptyState from "../common/emptyState";
77
import styles from "./libraryLoader.module.scss";
8-
import LoadLibraryForm from "./loadLibraryForm";
8+
import LoadLibraryForm, { LoadMockLibraryForm } from "./loadLibraryForm";
99

1010
export default function LibraryLoader(props: { children: React.ReactNode }) {
1111
const libraryInputFilepath = appStore.use.libraryInputFilepath();
1212
const libraryState = appStore.use.libraryLoadingState();
1313
const loadLibrary = appStore.use.loadSwinsianLibrary();
14+
const useMockData = appStore.use.useMockData();
1415

1516
useTaskEffect(
1617
function* () {
@@ -29,7 +30,7 @@ export default function LibraryLoader(props: { children: React.ReactNode }) {
2930
title="Select a Swinsian library"
3031
icon={<IoMusicalNotes size={48} />}
3132
>
32-
<LoadLibraryForm />
33+
{useMockData ? <LoadMockLibraryForm /> : <LoadLibraryForm />}
3334
</EmptyState>
3435
) : libraryState === "loading" ? (
3536
<EmptyState

packages/raga-web-app/src/components/library/loadLibraryForm.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,17 @@ function MaybeRecentlyUsedLibrariesSection({ formWidth }: { formWidth: number })
118118
</>
119119
);
120120
}
121+
122+
export function LoadMockLibraryForm() {
123+
const setLibraryInputFilepath = appStore.use.setLibraryInputFilepath();
124+
125+
const handleClick = useCallback(() => {
126+
setLibraryInputFilepath("/mock/library.xml");
127+
}, [setLibraryInputFilepath]);
128+
129+
return (
130+
<Stack gap="xs">
131+
<Button onClick={handleClick}>Load Mock Library</Button>
132+
</Stack>
133+
);
134+
}

0 commit comments

Comments
 (0)