From a7ada1a51968d6e9f9e8d99680b382197608c358 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Sun, 26 May 2024 13:44:04 +0200 Subject: [PATCH 1/2] feat: local development and complete steps --- docker-compose.yml | 12 ++++++++++++ juno.dev.config.js | 28 ++++++++++++++++++++++++++++ src/App.jsx | 7 +++---- src/components/Auth.jsx | 4 +--- src/components/Login.jsx | 5 +---- src/components/Logout.jsx | 4 +--- src/components/Modal.jsx | 35 +++++++++++++++-------------------- src/components/Table.jsx | 8 +++----- 8 files changed, 64 insertions(+), 39 deletions(-) create mode 100644 docker-compose.yml create mode 100644 juno.dev.config.js diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..58ef77e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +services: + juno-satellite: + image: junobuild/satellite:latest + ports: + - 5987:5987 + volumes: + - juno_satellite:/juno/.juno + - ./juno.dev.config.js:/juno/juno.dev.config.js + - ./target/deploy:/juno/target/deploy/ + +volumes: + juno_satellite: diff --git a/juno.dev.config.js b/juno.dev.config.js new file mode 100644 index 0000000..707537c --- /dev/null +++ b/juno.dev.config.js @@ -0,0 +1,28 @@ +import { defineDevConfig } from "@junobuild/config"; + +/** @type {import('@junobuild/config').JunoDevConfig} */ +export default defineDevConfig(() => ({ + satellite: { + collections: { + db: [ + { + collection: "notes", + read: "managed", + write: "managed", + memory: "storage", + mutablePermissions: false + }, + ], + storage: [ + { + collection: "images", + read: "managed", + write: "managed", + memory: "storage", + mutablePermissions: false + } + ], + }, + controllers: [], + }, +})); diff --git a/src/App.jsx b/src/App.jsx index 1f89520..14e2f1c 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -7,10 +7,9 @@ import { Modal } from "./components/Modal"; import { Table } from "./components/Table"; function App() { - // TODO: STEP_2_INITIALIZATION - // useEffect(() => { - // (async () => await initSatellite())(); - // }, []); + useEffect(() => { + (async () => await initSatellite())(); + }, []); return ( <> diff --git a/src/components/Auth.jsx b/src/components/Auth.jsx index 33ceab9..d6f2e36 100644 --- a/src/components/Auth.jsx +++ b/src/components/Auth.jsx @@ -10,9 +10,7 @@ export const Auth = ({ children }) => { const [user, setUser] = useState(undefined); useEffect(() => { - // TODO: STEP_4_AUTH_SUBSCRIBE - const sub = () => undefined; - // const sub = authSubscribe((user) => setUser(user)); + const sub = authSubscribe((user) => setUser(user)); return () => sub(); }, []); diff --git a/src/components/Login.jsx b/src/components/Login.jsx index 2885d51..e300ff0 100644 --- a/src/components/Login.jsx +++ b/src/components/Login.jsx @@ -2,8 +2,5 @@ import { signIn } from "@junobuild/core"; import { Button } from "./Button"; export const Login = () => { - //TODO: STEP_3_AUTH_SIGN_IN - // onClick={signIn} - - return ; + return ; }; diff --git a/src/components/Logout.jsx b/src/components/Logout.jsx index 2111dd5..80835be 100644 --- a/src/components/Logout.jsx +++ b/src/components/Logout.jsx @@ -1,11 +1,9 @@ import { signOut } from "@junobuild/core"; export const Logout = () => { - //TODO: STEP_5_AUTH_SIGN_OUT - // onClick={signOut} - return (