Skip to content

Commit

Permalink
feat(WIP): add dashboard (#12)
Browse files Browse the repository at this point in the history
* chore(cspell): update cspell dict

* chore: setup fronted end env

* feat: add file size example

* chore: rename to `@noctisynth/grassator`

* chore(cspell): add `primeicons` to dict

* feat(config): add config for grassator
  • Loading branch information
fu050409 authored Jul 12, 2024
1 parent 50a39a9 commit e0aadd4
Show file tree
Hide file tree
Showing 14 changed files with 210 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Unplugin
components.d.ts
3 changes: 3 additions & 0 deletions cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
"grassator",
"icns",
"noctisynth",
"pinia",
"primeicons",
"primevue",
"reqwest",
"serde",
"staticlib",
"tauri",
"toastservice",
"unocss",
"unplugin"
],
Expand Down
15 changes: 13 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tauri + Vue + TS</title>
<title>Grassator</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
<style>
html,
body,
#app {
height: 100%;
width: 100%;
margin: unset;
border: unset;
padding: unset;
}
</style>
</html>
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "grassator",
"name": "@noctisynth/grassator",
"private": true,
"version": "0.0.0",
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -13,9 +13,12 @@
"@primevue/themes": "^4.0.0",
"@tauri-apps/api": "2.0.0-beta.14",
"@tauri-apps/plugin-shell": "2.0.0-beta.7",
"pinia": "^2.1.7",
"primeicons": "^7.0.0",
"primevue": "^4.0.0",
"unocss": "^0.61.3",
"vue": "^3.4.31"
"vue": "^3.4.31",
"vue-router": "^4.4.0"
},
"devDependencies": {
"@primevue/auto-import-resolver": "^4.0.0",
Expand Down
77 changes: 77 additions & 0 deletions pnpm-lock.yaml

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

8 changes: 4 additions & 4 deletions src-tauri/Cargo.lock

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

9 changes: 8 additions & 1 deletion src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
mod models;
mod state;
mod utils;

#[tauri::command]
fn get_config(config: tauri::State<state::Config>) -> Result<state::Config, ()> {
Ok(config.inner().clone())
}

#[tauri::command]
async fn get_file_size(url: &str) -> Result<models::FileSize, ()> {
match utils::get_file_size(url).await {
Expand All @@ -15,8 +21,9 @@ async fn get_file_size(url: &str) -> Result<models::FileSize, ()> {
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.manage(state::Config::default())
.plugin(tauri_plugin_shell::init())
.invoke_handler(tauri::generate_handler![get_file_size])
.invoke_handler(tauri::generate_handler![get_config, get_file_size])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
16 changes: 16 additions & 0 deletions src-tauri/src/state.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub(crate) struct Config {
pub(crate) preset_file: String,
pub(crate) threads_count: u32,
}

impl Default for Config {
fn default() -> Self {
Self {
preset_file: String::from("presets/default.json"),
threads_count: 1,
}
}
}
4 changes: 1 addition & 3 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
</script>

<template>
<div class="container">

</div>
<RouterView />
</template>

<style scoped></style>
Loading

0 comments on commit e0aadd4

Please sign in to comment.