frontend
This commit is contained in:
parent
93b6abd22e
commit
84aa9b3e22
|
@ -1 +1,2 @@
|
|||
*.sqlite
|
||||
*.sqlite
|
||||
node_modules
|
|
@ -30,17 +30,17 @@ func main() {
|
|||
AllowHeaders: "Origin, Content-Type, Accept",
|
||||
}))
|
||||
|
||||
app.Get("/projects", handlers.GetAllProjects)
|
||||
app.Get("/project/:id", handlers.GetProject)
|
||||
app.Post("/project", handlers.CreateProject)
|
||||
app.Put("/project/:id", handlers.UpdateProject)
|
||||
app.Delete("/project/:id", handlers.DeleteProject)
|
||||
app.Get("/api/projects", handlers.GetAllProjects)
|
||||
app.Get("/api/project/:id", handlers.GetProject)
|
||||
app.Post("/api/project", handlers.CreateProject)
|
||||
app.Put("/api/project/:id", handlers.UpdateProject)
|
||||
app.Delete("/api/project/:id", handlers.DeleteProject)
|
||||
|
||||
app.Post("/list", handlers.CreateList)
|
||||
app.Get("/lists/:board_id", handlers.GetAllListsOf)
|
||||
app.Get("/list/:id", handlers.GetList)
|
||||
app.Delete("/list/:id", handlers.DeleteList)
|
||||
app.Put("/list/:id", handlers.UpdateList)
|
||||
app.Post("/api/list", handlers.CreateList)
|
||||
app.Get("/api/lists/:board_id", handlers.GetAllListsOf)
|
||||
app.Get("/api/list/:id", handlers.GetList)
|
||||
app.Delete("/api/list/:id", handlers.DeleteList)
|
||||
app.Put("/api/list/:id", handlers.UpdateList)
|
||||
|
||||
log.Fatal(app.Listen(fmt.Sprintf(":%v", port)))
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
|
||||
# Ignore files for PNPM, NPM and YARN
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
yarn.lock
|
|
@ -0,0 +1,31 @@
|
|||
/** @type { import("eslint").Linter.Config } */
|
||||
module.exports = {
|
||||
root: true,
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
'plugin:svelte/recommended',
|
||||
'prettier'
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
plugins: ['@typescript-eslint'],
|
||||
parserOptions: {
|
||||
sourceType: 'module',
|
||||
ecmaVersion: 2020,
|
||||
extraFileExtensions: ['.svelte']
|
||||
},
|
||||
env: {
|
||||
browser: true,
|
||||
es2017: true,
|
||||
node: true
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: ['*.svelte'],
|
||||
parser: 'svelte-eslint-parser',
|
||||
parserOptions: {
|
||||
parser: '@typescript-eslint/parser'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
|
@ -0,0 +1,10 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
.env
|
||||
.env.*
|
||||
!.env.example
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
|
@ -0,0 +1 @@
|
|||
engine-strict=true
|
|
@ -0,0 +1,4 @@
|
|||
# Ignore files for PNPM, NPM and YARN
|
||||
pnpm-lock.yaml
|
||||
package-lock.json
|
||||
yarn.lock
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"useTabs": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"printWidth": 100,
|
||||
"plugins": ["prettier-plugin-svelte"],
|
||||
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
# create-svelte
|
||||
|
||||
Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
|
||||
|
||||
## Creating a project
|
||||
|
||||
If you're seeing this, you've probably already done this step. Congrats!
|
||||
|
||||
```bash
|
||||
# create a new project in the current directory
|
||||
npm create svelte@latest
|
||||
|
||||
# create a new project in my-app
|
||||
npm create svelte@latest my-app
|
||||
```
|
||||
|
||||
## Developing
|
||||
|
||||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
|
||||
# or start the server and open the app in a new browser tab
|
||||
npm run dev -- --open
|
||||
```
|
||||
|
||||
## Building
|
||||
|
||||
To create a production version of your app:
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
You can preview the production build with `npm run preview`.
|
||||
|
||||
> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "frontend",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "playwright test",
|
||||
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --check . && eslint .",
|
||||
"format": "prettier --write ."
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.28.1",
|
||||
"@sveltejs/adapter-auto": "^3.0.0",
|
||||
"@sveltejs/kit": "^2.0.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.0",
|
||||
"@types/eslint": "8.56.0",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-svelte": "^2.35.1",
|
||||
"prettier": "^3.1.1",
|
||||
"prettier-plugin-svelte": "^3.1.2",
|
||||
"svelte": "^4.2.7",
|
||||
"svelte-check": "^3.6.0",
|
||||
"tslib": "^2.4.1",
|
||||
"typescript": "^5.0.0",
|
||||
"vite": "^5.0.3"
|
||||
},
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"axios": "^1.6.3"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
import type { PlaywrightTestConfig } from '@playwright/test';
|
||||
|
||||
const config: PlaywrightTestConfig = {
|
||||
webServer: {
|
||||
command: 'npm run build && npm run preview',
|
||||
port: 4173
|
||||
},
|
||||
testDir: 'tests',
|
||||
testMatch: /(.+\.)?(test|spec)\.[jt]s/
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -0,0 +1,13 @@
|
|||
// See https://kit.svelte.dev/docs/types#app
|
||||
// for information about these interfaces
|
||||
declare global {
|
||||
namespace App {
|
||||
// interface Error {}
|
||||
// interface Locals {}
|
||||
// interface PageData {}
|
||||
// interface PageState {}
|
||||
// interface Platform {}
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
|
@ -0,0 +1,12 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="icon" href="/img/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
%sveltekit.head%
|
||||
</head>
|
||||
<body data-sveltekit-preload-data="hover">
|
||||
<div style="display: contents">%sveltekit.body%</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1 @@
|
|||
// place files you want to import through the `$lib` alias in this folder.
|
|
@ -0,0 +1 @@
|
|||
export const ssr = false;
|
|
@ -0,0 +1,33 @@
|
|||
<script>
|
||||
import { projects } from "../stores/projects";
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<link rel="stylesheet" type="text/css" href="/css/index.css" />
|
||||
</svelte:head>
|
||||
|
||||
{#await projects.init()}
|
||||
<p>Loading ...</p>
|
||||
{:then}
|
||||
<div id="sidebar" class="sidebar">
|
||||
<div class="logo">
|
||||
<img src="img/icon.svg" alt="">
|
||||
<span class="title">Focus</span>
|
||||
<span class="version">v0.0.1</span>
|
||||
</div>
|
||||
<div class="boards">
|
||||
<h2>Projects</h2>
|
||||
<ul>
|
||||
{#each $projects as project}
|
||||
<!-- <li><a href="/{{project.id}}">{{project.title}}</a></li> -->
|
||||
{/each}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="bottom-links">
|
||||
<a href="#">Add board</a>
|
||||
<a href="#">Settings</a>
|
||||
</div>
|
||||
</div>
|
||||
{:catch error}
|
||||
<p>Something went wrong: {error.message}</p>
|
||||
{/await}
|
|
@ -0,0 +1,29 @@
|
|||
import axios from "axios";
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
export const projects = getProjects();
|
||||
|
||||
const backend = 'http://127.0.0.1:3000'
|
||||
|
||||
interface Project {
|
||||
id: number,
|
||||
title: string,
|
||||
}
|
||||
|
||||
function getProjects() {
|
||||
const { subscribe, set, update } = writable([]);
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
init: async () => {
|
||||
const response = await axios.get(`${backend}/api/projects`)
|
||||
console.log(response.data)
|
||||
|
||||
if(response.status < 303) {
|
||||
const projects: Project[] = response.data;
|
||||
|
||||
return projects;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
body {
|
||||
margin: 0;
|
||||
font-family: "Open sans", sans-serif;
|
||||
color: white;
|
||||
background-color: #2b2e30;
|
||||
}
|
||||
|
||||
#sidebar {
|
||||
width: 240px;
|
||||
background-color: #262a2b;
|
||||
color: white;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
#sidebar .logo {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#sidebar .logo img {
|
||||
max-height: 30px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
#sidebar .logo .title {
|
||||
padding-right: 10px;
|
||||
}
|
||||
#sidebar .logo .version {
|
||||
font-size: 0.8em;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
#sidebar .boards h2 {
|
||||
padding-left: 10px;
|
||||
font-size: 0.9em;
|
||||
margin-top: 20px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#sidebar .boards ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#sidebar .boards ul li a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
display: block;
|
||||
padding: 5px 10px;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
||||
#sidebar .boards ul li a:hover {
|
||||
background-color: #444;
|
||||
}
|
||||
|
||||
#sidebar .bottom-links {
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
#sidebar .bottom-links a {
|
||||
text-decoration: none;
|
||||
color: white;
|
||||
display: block;
|
||||
padding: 10px;
|
||||
font-size: 0.9em;
|
||||
border-top: 1px solid #444;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 5.1 KiB |
|
@ -0,0 +1,18 @@
|
|||
import adapter from '@sveltejs/adapter-auto';
|
||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
// Consult https://kit.svelte.dev/docs/integrations#preprocessors
|
||||
// for more information about preprocessors
|
||||
preprocess: vitePreprocess(),
|
||||
|
||||
kit: {
|
||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||
adapter: adapter()
|
||||
}
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"extends": "./.svelte-kit/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"moduleResolution": "bundler"
|
||||
}
|
||||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
|
||||
//
|
||||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
import { sveltekit } from '@sveltejs/kit/vite';
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [sveltekit()]
|
||||
});
|
Loading…
Reference in New Issue