From d850e0b92126f675f80b170664fb48fc8c449bb1 Mon Sep 17 00:00:00 2001 From: I Made Setia Baruna Date: Wed, 4 Nov 2020 11:29:45 +0700 Subject: [PATCH] Add data sync starting point --- .env.example | 2 + .gitignore | 1 + package.json | 3 +- rollup.config.js | 8 +++ src/components/DataSync.svelte | 96 ++++++++++++++++++++++++++ src/components/Sidebar/Sidebar.svelte | 6 ++ src/routes/_layout.svelte | 3 + src/routes/settings.svelte | 34 +++++++++ src/stores/dataSync.js | 4 ++ static/images/settings.png | Bin 0 -> 1969 bytes yarn.lock | 19 +++-- 11 files changed, 168 insertions(+), 8 deletions(-) create mode 100644 .env.example create mode 100644 src/components/DataSync.svelte create mode 100644 src/routes/settings.svelte create mode 100644 src/stores/dataSync.js create mode 100644 static/images/settings.png diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..ba3bd8e6 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +GOOGLE_DRIVE_CLIENT_ID= +GOOGLE_DRIVE_API_KEY= \ No newline at end of file diff --git a/.gitignore b/.gitignore index f220e375..1ab4bed0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /src/node_modules/@sapper/ yarn-error.log /__sapper__/ +.env \ No newline at end of file diff --git a/package.json b/package.json index adb7f147..29df3f53 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,10 @@ "@rollup/plugin-commonjs": "^14.0.0", "@rollup/plugin-dynamic-import-vars": "^1.1.0", "@rollup/plugin-node-resolve": "^8.0.0", - "@rollup/plugin-replace": "^2.2.0", + "@rollup/plugin-replace": "^2.3.4", "@rollup/plugin-url": "^5.0.0", "autoprefixer": "^10.0.1", + "dotenv": "^8.2.0", "postcss": "^8.1.2", "postcss-load-config": "^3.0.0", "postcss-nested": "^5.0.1", diff --git a/rollup.config.js b/rollup.config.js index 7d340904..ea82f368 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -7,6 +7,8 @@ import svelte from 'rollup-plugin-svelte'; import babel from '@rollup/plugin-babel'; import { terser } from 'rollup-plugin-terser'; import config from 'sapper/config/rollup.js'; +import { config as envConfig } from 'dotenv'; + import pkg from './package.json'; const mode = process.env.NODE_ENV; @@ -27,6 +29,9 @@ export default { replace({ 'process.browser': true, 'process.env.NODE_ENV': JSON.stringify(mode), + __paimon: JSON.stringify({ + env: envConfig().parsed, + }), }), svelte({ dev, @@ -85,6 +90,9 @@ export default { replace({ 'process.browser': false, 'process.env.NODE_ENV': JSON.stringify(mode), + __paimon: JSON.stringify({ + env: envConfig().parsed, + }), }), svelte({ generate: 'ssr', diff --git a/src/components/DataSync.svelte b/src/components/DataSync.svelte new file mode 100644 index 00000000..0c59db10 --- /dev/null +++ b/src/components/DataSync.svelte @@ -0,0 +1,96 @@ + diff --git a/src/components/Sidebar/Sidebar.svelte b/src/components/Sidebar/Sidebar.svelte index baf4f94d..90338b66 100644 --- a/src/components/Sidebar/Sidebar.svelte +++ b/src/components/Sidebar/Sidebar.svelte @@ -62,4 +62,10 @@ image="/images/calculator.png" label="Calculator" href="/calculator" /> + diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte index 9af4afae..b9a295dc 100644 --- a/src/routes/_layout.svelte +++ b/src/routes/_layout.svelte @@ -2,6 +2,7 @@ import Tailwind from '../components/Tailwindcss.svelte'; import Sidebar from '../components/Sidebar/Sidebar.svelte'; import Header from '../components/Header.svelte'; + import DataSync from '../components/DataSync.svelte'; import { showSidebar } from '../stores/sidebar'; @@ -26,3 +27,5 @@ Paimon.moe is not affiliated with miHoYo.
Genshin Impact, game content and materials are trademarks and copyrights of miHoYo.

+ + diff --git a/src/routes/settings.svelte b/src/routes/settings.svelte new file mode 100644 index 00000000..e120e6f7 --- /dev/null +++ b/src/routes/settings.svelte @@ -0,0 +1,34 @@ + + +
+ {#if $driveLoading} + + {:else} +

Drive signed in: {$driveSignedIn}

+ {#if !$driveSignedIn} + + {:else} + + {/if} + {/if} +
diff --git a/src/stores/dataSync.js b/src/stores/dataSync.js new file mode 100644 index 00000000..2fcca53a --- /dev/null +++ b/src/stores/dataSync.js @@ -0,0 +1,4 @@ +import { writable } from 'svelte/store'; + +export const driveSignedIn = writable(false); +export const driveLoading = writable(true); diff --git a/static/images/settings.png b/static/images/settings.png new file mode 100644 index 0000000000000000000000000000000000000000..c066947c7d2a89ec9b5e22f4ed1dfa76a64098f3 GIT binary patch literal 1969 zcmb_dYd8~n7$2)hXLOFJ$SpP`xh!PKWf4O=Y?jPDxl=CD8Y7n|l^vE1QJidIF4b`< z6Ut?kOQJ)HhM`#2NEzGVtkZe=pr=0dKF@pmy_etnJpT{>3rbL)I?{@w2DX!@4?0?{UBj4-)f`47OCit5Ec>HHozoio)Uu4alKbKKNAzJv=ehI!u@#E^6sWr`O z(%OL~UC}capF$zg05KpWxO8Z~_*a+C_xCTFO60BLs`d_pb7!Ud8;}0;QbT>NeqBt^ z=069|8(G)AN~%a_2$vQ=@&%!9W)_ww2`8_8c=u`gQrQZp_iq-OOFf1OztYx>)!Jf~ z>C8K_!$8*0>WRu}`3XJB(=)Kj>Oj)=$B3&vqdPBK9^TL-4vkJb_@b`?KHgeRQ}|0Q zZsXMRf}9d2c|=OiM#o;Ceye*d;UP=|09e<6u(oo+71UBz{rX)tw~#>7*#Y#Xs!+Ot zHkA{g81N=PHo#N!pJc^{SG4bpS9o_kzkrp?&5%m4^0}#+;41u7ihqBgrM+ad@Nh%bD$5is^`QvWkpFk=pLa9+%?sxi(8P zv_&-++g6KsOm%3Fy9Dj}v{a#qqgZP(@K-Rh17xUk#dTeS}xta}+MJ^Dk!d!RB zF<^SQ>qF3ho%fi8Ry&PZA2&dmu3=A-8mFt@{v{2qgqs(~xbe^o{ zz%_z2C!{AtpV*M>=M*456Q)$UI`N^@pX?nej`j`_J ztgyXBV%X8w3_KHploKi_k9R^P!UF*+yu@SMB0QZih4OGJB|RC(mFo($S;4fJfXr!- zHl+h>u1?2`(20HUI<$NQhCHFGTn+0jk=MC62rERUjonpx2|wJtvSD;SEZ@B`skhD@ zlUHeC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