Initial commit

This commit is contained in:
Oliver 2023-08-29 19:10:54 -06:00 committed by GitHub
commit e6d6427ddc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 4378 additions and 0 deletions

2
frontend/.env Normal file
View file

@ -0,0 +1,2 @@
VITE_API_URL=""
VITE_APP_NAME=""

0
frontend/README.md Normal file
View file

17
frontend/dockerfile Normal file
View file

@ -0,0 +1,17 @@
from node:19 as base
workdir /app
copy package*.json /app
run npm install
copy . /app
from base as dev
cmd [ "/bin/bash" ]
from base as prod
run npm install --global http-server
run npm run build
cmd [ "http-server", "./dist", "--no-dotfiles" ]

13
frontend/index.html Normal file
View file

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/png" href="/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>%VITE_APP_NAME%</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

1804
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

24
frontend/package.json Normal file
View file

@ -0,0 +1,24 @@
{
"name": "frontend",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite --host",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^2.4.2",
"@tsconfig/svelte": "^5.0.0",
"svelte": "^4.0.5",
"svelte-check": "^3.4.6",
"tslib": "^2.6.0",
"typescript": "^5.0.2",
"vite": "^4.4.5"
},
"dependencies": {
"svelte-i18n": "^3.7.0"
}
}

BIN
frontend/public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 B

View file

@ -0,0 +1,3 @@
{
"docs.svelte": "Svelte Docs"
}

19
frontend/src/App.svelte Normal file
View file

@ -0,0 +1,19 @@
<script lang="ts">
import { _, locale, locales } from "svelte-i18n";
import localeNames from "./locales";
</script>
<main>
<a href="https://svelte.dev/docs" target="_blank" rel="noreferrer">
{$_("docs.svelte")}
</a>
<br><br>
<select bind:value={$locale}>
{#each $locales as locale}
<option value="{locale}">{localeNames[locale]}</option>
{/each}
</select>
</main>
<style>
</style>

17
frontend/src/app.css Normal file
View file

@ -0,0 +1,17 @@
html, body {
padding: 0;
margin: 0;
min-height: 100vh;
min-width: 100vw;
}
body {
background-color: #2c2c32;
display: flex;
justify-content: center;
align-items: center;
}
a {
color: white;
}

8
frontend/src/locales.ts Normal file
View file

@ -0,0 +1,8 @@
export default {
"en-CA": "English (Canada)", // Canadian English
// "en-US": "English (United States)", // US English
// "en-GB": "English (Britain)", // British English
// "sv": "Svenska", // Swedish
// "cz": "", // Czech
// "nl": "", // Dutch
};

23
frontend/src/main.ts Normal file
View file

@ -0,0 +1,23 @@
import { getLocaleFromNavigator, init, register } from "svelte-i18n";
import "./app.css";
import App from "./App.svelte";
// Get all of the internationalization stuff registered and operational
import locales from "./locales";
for (const locale in locales) {
register(
locale,
() => fetch(`/locales/${locale}.json`).then(r => r.json())
);
};
await init({
fallbackLocale: `en-CA`,
initialLocale: getLocaleFromNavigator(),
});
const app = new App({
target: document.getElementById("app"),
});
export default app

2
frontend/src/vite-env.d.ts vendored Normal file
View file

@ -0,0 +1,2 @@
/// <reference types="svelte" />
/// <reference types="vite/client" />

View file

@ -0,0 +1,7 @@
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
export default {
// Consult https://svelte.dev/docs#compile-time-svelte-preprocess
// for more information about preprocessors
preprocess: vitePreprocess(),
}

19
frontend/tsconfig.json Normal file
View file

@ -0,0 +1,19 @@
{
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": {
"target": "ESNext",
"useDefineForClassFields": true,
"module": "ESNext",
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable checkJs if you'd like to use dynamic types in JS.
* Note that setting allowJs false does not prevent the use
* of JS in `.svelte` files.
*/
"allowJs": true,
"checkJs": true,
"isolatedModules": true
},
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.js", "src/**/*.svelte"],
"references": [{ "path": "./tsconfig.node.json" }]
}

View file

@ -0,0 +1,9 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler"
},
"include": ["vite.config.ts"]
}

7
frontend/vite.config.ts Normal file
View file

@ -0,0 +1,7 @@
import { defineConfig } from "vite"
import { svelte } from "@sveltejs/vite-plugin-svelte"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()],
})