diff --git a/.github/workflows/azure-static-web-apps-close-pr.yml b/.github/workflows/azure-static-web-apps-close-pr.yml new file mode 100644 index 0000000..168e81c --- /dev/null +++ b/.github/workflows/azure-static-web-apps-close-pr.yml @@ -0,0 +1,19 @@ +name: Azure Static Web Apps — Close PR + +on: + pull_request: + types: [closed] + branches: + - master + - dev + +jobs: + close_pull_request_job: + runs-on: ubuntu-latest + name: Close Pull Request Job + steps: + - name: Close Pull Request + uses: Azure/static-web-apps-deploy@v1 + with: + azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WHITE_ISLAND_090DFD003 }} + action: "close" diff --git a/.github/workflows/azure-static-web-apps-white-island-090dfd003.yml b/.github/workflows/azure-static-web-apps-white-island-090dfd003.yml index f7944a3..3da2c10 100644 --- a/.github/workflows/azure-static-web-apps-white-island-090dfd003.yml +++ b/.github/workflows/azure-static-web-apps-white-island-090dfd003.yml @@ -78,15 +78,3 @@ jobs: app_location: "app/dist" api_location: "app/api" output_location: "." - - close_pull_request_job: - if: github.event_name == 'pull_request' && github.event.action == 'closed' - runs-on: ubuntu-latest - name: Close Pull Request Job - steps: - - name: Close Pull Request - id: closepullrequest - uses: Azure/static-web-apps-deploy@v1 - with: - azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_WHITE_ISLAND_090DFD003 }} - action: "close" diff --git a/app/src/App.jsx b/app/src/App.jsx index 467a923..75e0832 100644 --- a/app/src/App.jsx +++ b/app/src/App.jsx @@ -9,6 +9,7 @@ import Report from "./components/Report"; import Bibliotek from "./components/Bibliotek"; import TemplatePicker from "./components/TemplatePicker"; import TemplateSessionEditor from "./components/TemplateSessionEditor"; +import Settings from "./components/Settings"; function App() { const [session, setSession] = useState(undefined); @@ -40,6 +41,7 @@ function App() { onShowHistoryWithDate: (dateStr) => { setHistoryInitialDate(dateStr); setView("history"); }, onShowTemplatePicker: () => setView("template-picker"), onShowReportWithPrefill: (prefill) => { setReportPrefill(prefill); setView("report"); }, + onShowSettings: () => setView("settings"), }; let content; @@ -66,6 +68,8 @@ function App() { setView("template-editor"); }} />; + else if (view === "settings") + content = ; else if (view === "template-editor" && templateEditorState) content = @@ -171,41 +164,16 @@ export default function PageShell({ children }) { - setTheme(theme === "g10" ? "g100" : "g10")}> - {theme === "g10" ? : } + + - supabase.auth.signOut()}> - + + {children} - - setChangelogOpen(true)} - aria-label="Vis endringslogg" - style={{ - display: "block", - width: "100%", - background: "none", - border: "none", - cursor: "pointer", - fontFamily: "var(--cds-font-mono)", - fontSize: 11, - color: "var(--cds-text-disabled)", - textAlign: "center", - padding: "32px 0 16px", - margin: 0, - letterSpacing: "0.08em", - }} - onMouseEnter={e => e.currentTarget.style.color = "var(--cds-text-secondary)"} - onMouseLeave={e => e.currentTarget.style.color = "var(--cds-text-disabled)"} - > - v{version} - - - setChangelogOpen(false)} /> ); diff --git a/app/src/components/Settings.jsx b/app/src/components/Settings.jsx new file mode 100644 index 0000000..3e3730a --- /dev/null +++ b/app/src/components/Settings.jsx @@ -0,0 +1,135 @@ +import { useEffect, useState } from "react"; +import { Toggle, Button } from "@carbon/react"; +import PageShell, { SectionLabel, PageHeading } from "./PageShell"; +import BodyPanel from "./BodyPanel"; +import ChangelogModal from "./ChangelogModal"; +import { useTheme } from "../theme"; +import { supabase } from "../lib/supabase"; +import { version } from "../../package.json"; + +const PREVIEW_PRIMARY = ["chest", "quads", "lats"]; +const PREVIEW_SECONDARY = ["shoulders_front", "hamstrings", "triceps"]; + +const cardStyle = { + background: "var(--cds-layer-01)", + border: "1px solid var(--cds-border-subtle-01)", + borderRadius: "var(--r-card)", + padding: 16, + marginBottom: 16, +}; + +export default function Settings() { + const { theme, setTheme } = useTheme(); + const [changelogOpen, setChangelogOpen] = useState(false); + const [userEmail, setUserEmail] = useState(""); + + useEffect(() => { + supabase.auth.getUser().then(({ data: { user } }) => { + if (user?.email) setUserEmail(user.email); + }); + }, []); + + return ( + + Innstillinger + + Utseende + + + setTheme(checked ? "g100" : "g10")} + /> + + + + + Konto + + + + {userEmail} + + supabase.auth.signOut()}> + Logg ut + + + + + Om appen + + + + v{version} + + setChangelogOpen(true)}> + Vis endringslogg + + + + + Kontakt + + + + Har du tilbakemeldinger eller fant en feil? Ta gjerne kontakt. + + + + Send e-post + + + Rapporter feil på GitHub + + + + + + Språk + + + + Kommer snart + + + + + setChangelogOpen(false)} /> + + ); +}
+ {userEmail} +
+ v{version} +
+ Har du tilbakemeldinger eller fant en feil? Ta gjerne kontakt. +
+ Kommer snart +