Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: continuing frontend integrations (DRAFT) #36

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@

With Docker Desktop installed and opened, you can run these commands at the root directory of this GitHub repo...
```shell
# if you are running this for the first time, or have made changes and want to see it take affect on its deployment, use this
# if you are running this for the first time, or have made changes
# and want to see it take affect on its deployment, use this
docker compose up -d --build
# starts the application in its detached state
docker compose up -d
Expand Down
4 changes: 1 addition & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ FROM node:19 as build

ENV NODE_ENV=production


WORKDIR /app

COPY package.json ./
COPY package-lock.json ./
COPY package*.json .
RUN npm install
COPY . ./
RUN npm run build
Expand Down
59 changes: 59 additions & 0 deletions frontend/package-lock.json

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

4 changes: 3 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
"test:integration": "playwright test",
"test:unit": "vitest",
"smui-theme": "smui-theme compile static/smui.css -i src/theme",
"prepare": "npm run smui-theme-light && npm run smui-theme-dark",
"prepare-smui": "npm run smui-theme-light && npm run smui-theme-dark",
"smui-theme-light": "smui-theme compile static/smui.css -i src/theme",
"smui-theme-dark": "smui-theme compile static/smui-dark.css -i src/theme/dark"
},
"devDependencies": {
"@mdi/js": "^7.4.47",
"@playwright/test": "^1.28.1",
"@smui/button": "^7.0.0",
"@smui/form-field": "^7.0.0",
"@smui/icon-button": "^7.0.0",
"@smui/top-app-bar": "^7.0.0",
"@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/kit": "^2.0.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0",
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/app.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
<!doctype html>
<html lang="en">
<head>
<title>Swole Goal</title>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="icon" href="%sveltekit.assets%/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- Roboto, and Roboto Mono fonts -->
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Mono:ital@0;1&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap"
rel="stylesheet"
/>
%sveltekit.head%
<style type=""text/css">
html, body {
padding: 0;
margin: 0;
}
</style>
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
Expand Down
58 changes: 45 additions & 13 deletions frontend/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- theming for the entire webapge -->
<svelte:head>
<!-- SMUI Styles -->
{#if darkTheme === undefined}
Expand All @@ -13,29 +14,60 @@
{/if}
</svelte:head>

<nav>
<a href="/">Home</a>
<a href="/about">About</a>
<a href="/settings">Settings</a>
<IconButton title={darkTheme ? 'Light mode' : 'Dark mode'}
on:click={() => (darkTheme = !darkTheme)}>
<Icon tag="svg"
viewBox="0 0 24 24">
<path fill="currentColor" d={darkTheme ? mdiWeatherSunny : mdiWeatherNight} />
</Icon>
</IconButton>
</nav>
<!-- Navbar for the landing page -->
<div class="landing-navbar">
<TopAppBar variant="static"
color={darkTheme ? 'secondary' : 'primary'}>
<Row>
<Section>

</Section>
<Section>
<Button on:click={() => goto('/')}
aria-label="Home">
SWOLE GOAL
</Button>
</Section>
<Section align="end" toolbar>
<Button on:click={() => goto('/about')}
aria-label="About">
ABOUT
</Button>
<Button on:click={() => goto('/login')}
aria-label="Login">
LOGIN
</Button>
<IconButton title={darkTheme ? 'Light mode' : 'Dark mode'}
on:click={() => (darkTheme = !darkTheme)}>
<Icon tag="svg"
viewBox="0 0 24 24">
<path fill="currentColor" d={darkTheme ? mdiWeatherSunny : mdiWeatherNight} />
</Icon>
</IconButton>
</Section>
</Row>
</TopAppBar>
</div>

<slot></slot>

<script lang="ts">
import { onMount } from 'svelte'
import IconButton, { Icon } from '@smui/icon-button'
import Button from "@smui/button"
import { mdiWeatherSunny, mdiWeatherNight } from '@mdi/js';
import TopAppBar, { Row, Section, Title } from '@smui/top-app-bar';
import { goto } from '$app/navigation';

let darkTheme: boolean | undefined = undefined

onMount(() => {
darkTheme = window.matchMedia('(prefers-color-scheme: dark)').matches
})
</script>
</script>

<style lang="scss" scoped>
.landing-navbar {
font-family: "Comic Sans MS", "Comic Sans", cursive;
}
</style>
46 changes: 29 additions & 17 deletions frontend/src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
<div>Hello.</div>
<Welcome project="Not Swole Goal" />
<Button
on:click={() => alert('It worked!')}
color="secondary">
Click me!
</Button>
<Button
on:click={() => alert('It worked!')}
color="primary">
Click me too!
</Button>
<IconButton on:click={() => clicked++}>
<Icon tag="svg" viewBox="0 0 24 24">
<path fill="currentColor" d={mdiFormatColorFill} />
</Icon>
</IconButton>
<main class="main">
<Welcome />
<Button
on:click={() => alert('It worked!')}
color="secondary">
Click me!
</Button>
<Button
on:click={() => alert('It worked!')}
color="primary">
Click me too!
</Button>
<IconButton on:click={() => clicked++}>
<Icon tag="svg" viewBox="0 0 24 24">
<path fill="currentColor" d={mdiFormatColorFill} />
</Icon>
</IconButton>
</main>

<script lang="ts">
import Welcome from "./Welcome.svelte"
Expand All @@ -24,3 +25,14 @@

let clicked = 0
</script>

<style lang="scss">
.main {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
</style>
2 changes: 1 addition & 1 deletion frontend/src/routes/Welcome.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</script>

<h1>Welcome to project {project}</h1>
<p>Visit <a href="https://github.com/emoral435/swole-goal">the repository</a> to find out more about this project!</p>
<p >Visit <a href="https://github.com/emoral435/swole-goal">the repository</a> to find out more about this project!</p>
<a href="/about">Click here to visit the about page.</a>

<input type="number" bind:value={age} />
Expand Down
Empty file removed frontend/src/routes/about.svelte
Empty file.
3 changes: 3 additions & 0 deletions frontend/src/routes/login/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<h1>Login using name and other qualities...</h1>
<p>TODO...</p>
<a href="/">Home</a>
Binary file removed frontend/static/favicon.png
Binary file not shown.
7 changes: 7 additions & 0 deletions frontend/static/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion frontend/static/smui-dark.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/static/smui.css

Large diffs are not rendered by default.

Loading