Skip to content

Commit e8d7f9f

Browse files
authored
PR preview + mock library loader (#366)
1 parent 1e34ff7 commit e8d7f9f

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

.github/workflows/preview.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Deploy PR Preview
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, closed]
5+
6+
permissions:
7+
contents: read
8+
pull-requests: write
9+
10+
jobs:
11+
preview:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: "22"
18+
- name: Enable Corepack
19+
run: corepack enable
20+
- name: Use Yarn 4.7.0
21+
run: corepack prepare [email protected] --activate
22+
- run: yarn
23+
- run: yarn build:web
24+
- uses: rossjrw/[email protected]
25+
with:
26+
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)