Next steps
This commit is contained in:
178
src/App.vue
178
src/App.vue
@@ -1,160 +1,34 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
const greetMsg = ref("");
|
||||
const name = ref("");
|
||||
|
||||
async function greet() {
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
greetMsg.value = await invoke("greet", { name: name.value });
|
||||
}
|
||||
import { PhCheckSquareOffset, PhListChecks, PhSliders } from '@phosphor-icons/vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { computed } from 'vue';
|
||||
const router = useRouter();
|
||||
const currentPath = computed(() => router.currentRoute.value.path);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<main class="container">
|
||||
<h1>Welcome to Tauri + Vue</h1>
|
||||
<div class="overflow-hidden">
|
||||
|
||||
<div class="row">
|
||||
<a href="https://vite.dev" target="_blank">
|
||||
<img src="/vite.svg" class="logo vite" alt="Vite logo" />
|
||||
</a>
|
||||
<a href="https://tauri.app" target="_blank">
|
||||
<img src="/tauri.svg" class="logo tauri" alt="Tauri logo" />
|
||||
</a>
|
||||
<a href="https://vuejs.org/" target="_blank">
|
||||
<img src="./assets/vue.svg" class="logo vue" alt="Vue logo" />
|
||||
</a>
|
||||
<main class="pb-40 overflow-y-scroll h-screen">
|
||||
<RouterView v-slot="{ Component }">
|
||||
<Transition name="fade">
|
||||
<component :is="Component" />
|
||||
</Transition>
|
||||
</RouterView>
|
||||
</main>
|
||||
<div class="dock dock-xl bg-neutral-400">
|
||||
<RouterLink to="/create" :class="currentPath === '/create' ? 'dock-active' : ''">
|
||||
<PhCheckSquareOffset :size="32" />
|
||||
</RouterLink>
|
||||
|
||||
<RouterLink to="/" :class="currentPath === '/' ? 'dock-active' : ''">
|
||||
<PhListChecks :size="32" />
|
||||
</RouterLink>
|
||||
|
||||
<RouterLink to="/settings" :class="currentPath === '/settings' ? 'dock-active' : ''">
|
||||
<PhSliders :size="32" />
|
||||
</RouterLink>
|
||||
</div>
|
||||
<p>Click on the Tauri, Vite, and Vue logos to learn more.</p>
|
||||
</div>
|
||||
|
||||
<form class="row" @submit.prevent="greet">
|
||||
<input id="greet-input" v-model="name" placeholder="Enter a name..." />
|
||||
<button type="submit">Greet</button>
|
||||
</form>
|
||||
<p>{{ greetMsg }}</p>
|
||||
</main>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.logo.vite:hover {
|
||||
filter: drop-shadow(0 0 2em #747bff);
|
||||
}
|
||||
|
||||
.logo.vue:hover {
|
||||
filter: drop-shadow(0 0 2em #249b73);
|
||||
}
|
||||
|
||||
</style>
|
||||
<style>
|
||||
:root {
|
||||
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
|
||||
font-size: 16px;
|
||||
line-height: 24px;
|
||||
font-weight: 400;
|
||||
|
||||
color: #0f0f0f;
|
||||
background-color: #f6f6f6;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0;
|
||||
padding-top: 10vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
height: 6em;
|
||||
padding: 1.5em;
|
||||
will-change: filter;
|
||||
transition: 0.75s;
|
||||
}
|
||||
|
||||
.logo.tauri:hover {
|
||||
filter: drop-shadow(0 0 2em #24c8db);
|
||||
}
|
||||
|
||||
.row {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
a {
|
||||
font-weight: 500;
|
||||
color: #646cff;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #535bf2;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
border-radius: 8px;
|
||||
border: 1px solid transparent;
|
||||
padding: 0.6em 1.2em;
|
||||
font-size: 1em;
|
||||
font-weight: 500;
|
||||
font-family: inherit;
|
||||
color: #0f0f0f;
|
||||
background-color: #ffffff;
|
||||
transition: border-color 0.25s;
|
||||
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
border-color: #396cd8;
|
||||
}
|
||||
button:active {
|
||||
border-color: #396cd8;
|
||||
background-color: #e8e8e8;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#greet-input {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
color: #f6f6f6;
|
||||
background-color: #2f2f2f;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #24c8db;
|
||||
}
|
||||
|
||||
input,
|
||||
button {
|
||||
color: #ffffff;
|
||||
background-color: #0f0f0f98;
|
||||
}
|
||||
button:active {
|
||||
background-color: #0f0f0f69;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
20
src/components/Tauri.vue
Normal file
20
src/components/Tauri.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
|
||||
const greetMsg = ref("");
|
||||
const name = ref("");
|
||||
|
||||
async function greet() {
|
||||
// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
|
||||
greetMsg.value = await invoke("greet", { name: name.value });
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<form class="row" @submit.prevent="greet">
|
||||
<input id="greet-input" v-model="name" placeholder="Enter a name..." />
|
||||
<button class="btn" type="submit">Greet</button>
|
||||
</form>
|
||||
<p>{{ greetMsg }}</p>
|
||||
</template>
|
||||
@@ -1,4 +1,5 @@
|
||||
import { createApp } from "vue";
|
||||
import App from "./App.vue";
|
||||
import { router } from './router.ts';
|
||||
|
||||
createApp(App).mount("#app");
|
||||
createApp(App).use(router).mount("#app");
|
||||
|
||||
16
src/router.ts
Normal file
16
src/router.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { createWebHistory, createRouter } from 'vue-router'
|
||||
import ListScreen from './screens/ListScreen.vue';
|
||||
import SettingsScreen from './screens/SettingsScreen.vue';
|
||||
import CreateScreen from './screens/CreateScreen.vue';
|
||||
|
||||
|
||||
const routes = [
|
||||
{ path: '/', component: ListScreen },
|
||||
{ path: '/settings', component: SettingsScreen },
|
||||
{ path: '/create', component: CreateScreen }
|
||||
]
|
||||
|
||||
export const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
})
|
||||
41
src/screens/CreateScreen.vue
Normal file
41
src/screens/CreateScreen.vue
Normal file
@@ -0,0 +1,41 @@
|
||||
<script setup lang="ts">
|
||||
import { fetch } from '@tauri-apps/plugin-http';
|
||||
import { router } from '../router.ts';
|
||||
import { Task } from '../types.ts';
|
||||
|
||||
const handleSubmit = async(e: Event) => {
|
||||
const data = new FormData(e.target as HTMLFormElement);
|
||||
const task: Partial<Task> = Object.fromEntries(data)
|
||||
|
||||
const nextId = await fetch(
|
||||
'https://automation.deep-node.de/webhook/d49dde4c-530d-46ee-8205-d1357563ac16',
|
||||
{ method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': 'Basic cGF1bDoxMG1hYmF1MTU=', }}
|
||||
).then((response) => response.json()).then((json) => json.nextId as number).catch(() => null);
|
||||
|
||||
if (!nextId) return;
|
||||
task.id_ = nextId;
|
||||
task.logs = [];
|
||||
|
||||
await fetch(
|
||||
'https://automation.deep-node.de/webhook/e5880167-9322-4d7b-8a38-e06bae8a7734/list',
|
||||
{ method: 'PUT', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ tasks: [task] } )}
|
||||
);
|
||||
await router.push('/');
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<form @submit.prevent="handleSubmit">
|
||||
<fieldset class="fieldset">
|
||||
<legend class="fieldset-legend">What is your name?</legend>
|
||||
<input type="text" class="input" name="title" placeholder="Type here" />
|
||||
</fieldset>
|
||||
<button class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
73
src/screens/ListScreen.vue
Normal file
73
src/screens/ListScreen.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<script setup lang="ts">
|
||||
import { fetch } from '@tauri-apps/plugin-http';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { Task, TaskStatus } from '../types.ts';
|
||||
import { PhCaretDown, PhCaretUp, PhCheckSquare, PhDotsThree, PhPlay, PhSquare } from '@phosphor-icons/vue';
|
||||
|
||||
const rawTasks = ref<Task[]>([]);
|
||||
|
||||
onMounted(async () => {
|
||||
rawTasks.value = await fetch('https://automation.deep-node.de/webhook/e5880167-9322-4d7b-8a38-e06bae8a7734/list', { method: 'GET', headers: { 'Content-Type': 'application/json'} })
|
||||
.then(response => response.json())
|
||||
.then((data: { tasks: Task[] }) => rawTasks.value = data.tasks ?? [])
|
||||
.catch(() => []);
|
||||
})
|
||||
|
||||
const visibleTasks = computed(() => rawTasks.value.filter(task => !task.archived))
|
||||
|
||||
const categorizedTasks = computed(() => visibleTasks.value.reduce((acc, task) => {
|
||||
const tag = task.tag ?? 'Uncategorized';
|
||||
acc[tag] = acc[tag] ?? [];
|
||||
acc[tag].push(task);
|
||||
return acc;
|
||||
}, {} as Record<string, Task[]>))
|
||||
|
||||
const collapsed = ref<string[]>([]);
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="flex flex-col gap-4">
|
||||
<div class="m-4 rounded-box border border-neutral-100 shadow-md" v-for="(tasks, category) in categorizedTasks" :key="category">
|
||||
<div class="m-4 flex justify-between items-center">
|
||||
<div class="badge badge-xl badge-primary">{{ category }}</div>
|
||||
<button
|
||||
@click="collapsed.includes(category) ? collapsed.splice(collapsed.indexOf(category), 1) : collapsed.push(category)"
|
||||
class="btn btn-square btn-sm"
|
||||
>
|
||||
<PhCaretDown :size="20" v-if="collapsed.includes(category)" />
|
||||
<PhCaretUp :size="20" v-else />
|
||||
</button>
|
||||
</div>
|
||||
<Transition name="fade">
|
||||
<ul v-if="!collapsed.includes(category)" class="list bg-base-100 rounded-box" >
|
||||
<li class="list-row" v-for="task in tasks" :key="task.id">
|
||||
<div class="flex items-center justify-center">
|
||||
<PhSquare v-if="task.status === TaskStatus.WAIT" :size="20" />
|
||||
<PhCheckSquare v-else-if="task.status === TaskStatus.DONE" :size="20" weight="fill" class="text-success" />
|
||||
<PhSquare v-else-if="task.status === TaskStatus.FLAG" :size="20" weight="fill" class="text-warning" />
|
||||
<PhPlay v-else-if="task.status === TaskStatus.WIP" :size="20" weight="fill" class="text-info" />
|
||||
</div>
|
||||
<div class="flex items-center gap-2">
|
||||
<div>{{task.title}}</div>
|
||||
|
||||
</div>
|
||||
<button class="btn btn-square btn-ghost btn-sm">
|
||||
<PhDotsThree :size="24" weight="regular" />
|
||||
</button>
|
||||
</li>
|
||||
|
||||
|
||||
</ul>
|
||||
</Transition>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
13
src/screens/SettingsScreen.vue
Normal file
13
src/screens/SettingsScreen.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
Settings SCREEN
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
50
src/styles/main.css
Normal file
50
src/styles/main.css
Normal file
@@ -0,0 +1,50 @@
|
||||
@import "tailwindcss";
|
||||
@plugin "daisyui";
|
||||
|
||||
|
||||
@plugin "daisyui/theme" {
|
||||
name: "emerald";
|
||||
default: true;
|
||||
prefersdark: true;
|
||||
color-scheme: "light";
|
||||
--color-base-100: oklch(100% 0 0);
|
||||
--color-base-200: oklch(93% 0 0);
|
||||
--color-base-300: oklch(86% 0 0);
|
||||
--color-base-content: oklch(35.519% 0.032 262.988);
|
||||
--color-primary: oklch(76.662% 0.135 153.45);
|
||||
--color-primary-content: oklch(33.387% 0.04 162.24);
|
||||
--color-secondary: oklch(61.302% 0.202 261.294);
|
||||
--color-secondary-content: oklch(100% 0 0);
|
||||
--color-accent: oklch(72.772% 0.149 33.2);
|
||||
--color-accent-content: oklch(0% 0 0);
|
||||
--color-neutral: oklch(35.519% 0.032 262.988);
|
||||
--color-neutral-content: oklch(98.462% 0.001 247.838);
|
||||
--color-info: oklch(72.06% 0.191 231.6);
|
||||
--color-info-content: oklch(0% 0 0);
|
||||
--color-success: oklch(64.8% 0.15 160);
|
||||
--color-success-content: oklch(0% 0 0);
|
||||
--color-warning: oklch(84.71% 0.199 83.87);
|
||||
--color-warning-content: oklch(0% 0 0);
|
||||
--color-error: oklch(71.76% 0.221 22.18);
|
||||
--color-error-content: oklch(0% 0 0);
|
||||
--radius-selector: 1rem;
|
||||
--radius-field: 0.5rem;
|
||||
--radius-box: 1rem;
|
||||
--size-selector: 0.25rem;
|
||||
--size-field: 0.25rem;
|
||||
--border: 1px;
|
||||
--depth: 0;
|
||||
--noise: 0;
|
||||
}
|
||||
|
||||
/* Transitions */
|
||||
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
transition: opacity 0.25s ease;
|
||||
}
|
||||
|
||||
.fade-enter-from,
|
||||
.fade-leave-to {
|
||||
opacity: 0;
|
||||
}
|
||||
25
src/types.ts
Normal file
25
src/types.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
export enum TaskStatus {
|
||||
NONE,
|
||||
DONE,
|
||||
WIP,
|
||||
WAIT,
|
||||
FLAG,
|
||||
}
|
||||
|
||||
export type Worklog = {
|
||||
start: number;
|
||||
end: number;
|
||||
};
|
||||
|
||||
export type Task = {
|
||||
"uuid": string,
|
||||
"archived": boolean,
|
||||
"tag": string,
|
||||
"title": string,
|
||||
"status": TaskStatus,
|
||||
"lastaction": number,
|
||||
"logs": Worklog[],
|
||||
"dueDate": number,
|
||||
"id_": number,
|
||||
"id": number
|
||||
}
|
||||
Reference in New Issue
Block a user