-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support auto dark theme, new font, delete project, show in folder
- Loading branch information
Showing
10 changed files
with
176 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,19 @@ | ||
<template> | ||
<Toast/> | ||
<DynamicDialog /> | ||
<ConfirmDialog /> | ||
<router-view></router-view> | ||
</template> | ||
|
||
<script setup> | ||
import Toast from 'primevue/toast'; | ||
import DynamicDialog from "primevue/dynamicdialog"; | ||
import ConfirmDialog from "primevue/confirmdialog"; | ||
</script> | ||
|
||
<style> | ||
html { | ||
font-size: 12px; | ||
font-family: 'Inter Variable', sans-serif; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,42 @@ | ||
import {Store} from "@tauri-apps/plugin-store"; | ||
import {Project} from "../models/Project.ts"; | ||
import dayjs from "dayjs"; | ||
import {BaseDirectory, remove} from "@tauri-apps/plugin-fs"; | ||
|
||
const projectsStore = new Store("projects"); | ||
try { | ||
await projectsStore.load(); | ||
await projectsStore.load(); | ||
} catch (e) { | ||
console.error("Failed to load store from disk", e); | ||
console.error("Failed to load store from disk", e); | ||
} | ||
console.log('projects', await getProjects()); | ||
|
||
|
||
export async function getProjects() { | ||
const rawProjects = await projectsStore.values(); | ||
return rawProjects.map((projectData) => Project.fromJson(projectData)) | ||
const rawProjects = await projectsStore.values(); | ||
return rawProjects.map((projectData) => Project.fromJson(projectData)) | ||
} | ||
|
||
export function getProject(id: string) { | ||
return projectsStore.get(id); | ||
export function getProjectById(id: string) { | ||
return projectsStore.get(id); | ||
} | ||
|
||
export async function saveProject(id: string, projectData: Project) { | ||
projectData.updatedAt = dayjs().unix(); | ||
export async function saveProjectById(id: string, projectData: Project) { | ||
projectData.updatedAt = dayjs().unix(); | ||
|
||
await projectsStore.set(id, projectData); | ||
await projectsStore.set(id, projectData); | ||
await projectsStore.save() | ||
} | ||
|
||
export async function createProject(projectName: string) { | ||
const newProject = new Project(projectName); | ||
const newProject = new Project(projectName); | ||
|
||
await saveProject(newProject.id, newProject) | ||
await saveProjectById(newProject.id, newProject) | ||
} | ||
|
||
export async function deleteProjectById(id: string) { | ||
const project = Project.fromJson(await getProjectById(id)) | ||
await remove(project.path, {baseDir: BaseDirectory.Home, recursive: true}) | ||
await projectsStore.delete(id); | ||
await projectsStore.save(); | ||
} |
Oops, something went wrong.