Skip to content

Commit

Permalink
Merge pull request #1 from IMMM-SFA/sample/working-sankey-and-deploym…
Browse files Browse the repository at this point in the history
…ent-example

sveltize plotly stuff and add sample deployment action
  • Loading branch information
kmongird authored Dec 13, 2024
2 parents c4cb115 + ff29e4d commit caeecf8
Show file tree
Hide file tree
Showing 8 changed files with 256 additions and 200 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./sankey_dashboard
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build
env:
NODE_ENV: production
run: npm run build
- name: Commit the build dir
run: |
cd build
git init
git add -A
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m 'deploy' -a || true
- name: Push changes to gh-pages
uses: ad-m/github-push-action@master
with:
branch: gh-pages
directory: build
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}

33 changes: 6 additions & 27 deletions sankey_dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion sankey_dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"dependencies": {
"@sveltejs/adapter-static": "^3.0.6",
"papaparse": "^5.4.1",
"plotly": "^1.0.6"
"plotly.js-dist-min": "^2.35.2"
}
}
2 changes: 1 addition & 1 deletion sankey_dashboard/src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%

<script src="https://cdn.plot.ly/plotly-2.35.2.min.js" charset="utf-8"></script>

</head>
<body data-sveltekit-preload-data="hover">
Expand Down
29 changes: 18 additions & 11 deletions sankey_dashboard/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@


<script>
const nav_items = ["home", "about"] ;
// this variable will be important if deploying to a non-root url,
// such as with github pages when you don't have a custom domain;
// defined in `svelte.config.js`
import { base } from '$app/paths';
const nav_items = ["home", "about"] ;
</script>

<style>
</style>

<div>
<div id="navbar">

{#each nav_items as item}
<a href="/{item}"> {item}</a>
{/each}
{#each nav_items as item}
<a href="{base}/{item === "home" ? '' : item}">{item}</a>
{/each}

</div>

<slot></slot>
<slot/>

<style>
#navbar {
display: flex;
flex-direction: row;
gap: 2rem;
}
</style>
Loading

0 comments on commit caeecf8

Please sign in to comment.