Skip to content

Commit b000709

Browse files
committed
feat: tauri setup completed and @firecamp/desktop app initialised
1 parent 396c969 commit b000709

38 files changed

+1156
-40
lines changed

packages/firecamp-desktop/.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"]
3+
}

packages/firecamp-desktop/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Tauri + React + Typescript
2+
3+
This template should help get you started developing with Tauri, React and Typescript in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)

packages/firecamp-desktop/index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Tauri + React + TS</title>
8+
</head>
9+
10+
<body>
11+
<div id="root"></div>
12+
<script type="module" src="/src/main.tsx"></script>
13+
</body>
14+
</html>
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "firecamp-desktop",
3+
"private": true,
4+
"version": "0.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"preview": "vite preview",
10+
"tauri": "tauri"
11+
},
12+
"dependencies": {
13+
"react": "^18.2.0",
14+
"react-dom": "^18.2.0",
15+
"@tauri-apps/api": "^1.4.0"
16+
},
17+
"devDependencies": {
18+
"@types/react": "^18.2.15",
19+
"@types/react-dom": "^18.2.7",
20+
"@vitejs/plugin-react": "^4.0.3",
21+
"typescript": "^5.0.2",
22+
"vite": "^4.4.4",
23+
"@tauri-apps/cli": "2.0.0-alpha.9"
24+
}
25+
}
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Generated by Cargo
2+
# will have compiled files and executables
3+
/target/
4+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[package]
2+
name = "firecamp-desktop"
3+
version = "0.0.0"
4+
description = "A Tauri App"
5+
authors = ["you"]
6+
license = ""
7+
repository = ""
8+
edition = "2021"
9+
10+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
11+
12+
[build-dependencies]
13+
tauri-build = { version = "2.0.0-alpha.5", features = [] }
14+
15+
[dependencies]
16+
tauri = { version = "2.0.0-alpha.9", features = [] }
17+
serde = { version = "1.0", features = ["derive"] }
18+
serde_json = "1.0"
19+
20+
[features]
21+
# this feature is used for production builds or when `devPath` points to the filesystem
22+
# DO NOT REMOVE!!
23+
custom-protocol = ["tauri/custom-protocol"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
tauri_build::build()
3+
}
Loading
Loading
974 Bytes
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Binary file not shown.
Binary file not shown.
Loading

packages/firecamp-desktop/src-tauri/rustc-ice-2023-08-29T12:21:32.539513Z-24344.txt

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
2+
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
3+
4+
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
5+
#[tauri::command]
6+
fn greet(name: &str) -> String {
7+
format!("Hello, {}! You've been greeted from Rust!", name)
8+
}
9+
10+
fn main() {
11+
tauri::Builder::default()
12+
.invoke_handler(tauri::generate_handler![greet])
13+
.run(tauri::generate_context!())
14+
.expect("error while running tauri application");
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"build": {
3+
"beforeDevCommand": "pnpm dev",
4+
"beforeBuildCommand": "pnpm build",
5+
"devPath": "http://localhost:3000",
6+
"distDir": "../dist",
7+
"withGlobalTauri": false
8+
},
9+
"package": {
10+
"productName": "firecamp-desktop",
11+
"version": "0.0.0"
12+
},
13+
"tauri": {
14+
"bundle": {
15+
"active": true,
16+
"targets": "all",
17+
"identifier": "com.tauri.dev",
18+
"icon": [
19+
"icons/32x32.png",
20+
"icons/128x128.png",
21+
22+
"icons/icon.icns",
23+
"icons/icon.ico"
24+
]
25+
},
26+
"security": {
27+
"csp": null
28+
},
29+
"windows": [
30+
{
31+
"fullscreen": false,
32+
"resizable": true,
33+
"title": "firecamp-desktop",
34+
"width": 800,
35+
"height": 600
36+
}
37+
]
38+
}
39+
}

packages/firecamp-desktop/src/App.css

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.logo.vite:hover {
2+
filter: drop-shadow(0 0 2em #747bff);
3+
}
4+
5+
.logo.react:hover {
6+
filter: drop-shadow(0 0 2em #61dafb);
7+
}

packages/firecamp-desktop/src/App.tsx

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { useState } from "react";
2+
import reactLogo from "./assets/react.svg";
3+
import { invoke } from "@tauri-apps/api/tauri";
4+
import "./App.css";
5+
6+
function App() {
7+
const [greetMsg, setGreetMsg] = useState("");
8+
const [name, setName] = useState("");
9+
10+
async function greet() {
11+
// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
12+
setGreetMsg(await invoke("greet", { name }));
13+
}
14+
15+
return (
16+
<div className="container">
17+
<h1>Welcome to Tauri!</h1>
18+
19+
<div className="row">
20+
<a href="https://vitejs.dev" target="_blank">
21+
<img src="/vite.svg" className="logo vite" alt="Vite logo" />
22+
</a>
23+
<a href="https://tauri.app" target="_blank">
24+
<img src="/tauri.svg" className="logo tauri" alt="Tauri logo" />
25+
</a>
26+
<a href="https://reactjs.org" target="_blank">
27+
<img src={reactLogo} className="logo react" alt="React logo" />
28+
</a>
29+
</div>
30+
31+
<p>Click on the Tauri, Vite, and React logos to learn more.</p>
32+
33+
<form
34+
className="row"
35+
onSubmit={(e) => {
36+
e.preventDefault();
37+
greet();
38+
}}
39+
>
40+
<input
41+
id="greet-input"
42+
onChange={(e) => setName(e.currentTarget.value)}
43+
placeholder="Enter a name..."
44+
/>
45+
<button type="submit">Greet</button>
46+
</form>
47+
48+
<p>{greetMsg}</p>
49+
</div>
50+
);
51+
}
52+
53+
export default App;
Loading
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import React from "react";
2+
import ReactDOM from "react-dom/client";
3+
import App from "./App";
4+
import "./styles.css";
5+
6+
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
7+
<React.StrictMode>
8+
<App />
9+
</React.StrictMode>,
10+
);
+109
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
:root {
2+
font-family: Inter, Avenir, Helvetica, Arial, sans-serif;
3+
font-size: 16px;
4+
line-height: 24px;
5+
font-weight: 400;
6+
7+
color: #0f0f0f;
8+
background-color: #f6f6f6;
9+
10+
font-synthesis: none;
11+
text-rendering: optimizeLegibility;
12+
-webkit-font-smoothing: antialiased;
13+
-moz-osx-font-smoothing: grayscale;
14+
-webkit-text-size-adjust: 100%;
15+
}
16+
17+
.container {
18+
margin: 0;
19+
padding-top: 10vh;
20+
display: flex;
21+
flex-direction: column;
22+
justify-content: center;
23+
text-align: center;
24+
}
25+
26+
.logo {
27+
height: 6em;
28+
padding: 1.5em;
29+
will-change: filter;
30+
transition: 0.75s;
31+
}
32+
33+
.logo.tauri:hover {
34+
filter: drop-shadow(0 0 2em #24c8db);
35+
}
36+
37+
.row {
38+
display: flex;
39+
justify-content: center;
40+
}
41+
42+
a {
43+
font-weight: 500;
44+
color: #646cff;
45+
text-decoration: inherit;
46+
}
47+
48+
a:hover {
49+
color: #535bf2;
50+
}
51+
52+
h1 {
53+
text-align: center;
54+
}
55+
56+
input,
57+
button {
58+
border-radius: 8px;
59+
border: 1px solid transparent;
60+
padding: 0.6em 1.2em;
61+
font-size: 1em;
62+
font-weight: 500;
63+
font-family: inherit;
64+
color: #0f0f0f;
65+
background-color: #ffffff;
66+
transition: border-color 0.25s;
67+
box-shadow: 0 2px 2px rgba(0, 0, 0, 0.2);
68+
}
69+
70+
button {
71+
cursor: pointer;
72+
}
73+
74+
button:hover {
75+
border-color: #396cd8;
76+
}
77+
button:active {
78+
border-color: #396cd8;
79+
background-color: #e8e8e8;
80+
}
81+
82+
input,
83+
button {
84+
outline: none;
85+
}
86+
87+
#greet-input {
88+
margin-right: 5px;
89+
}
90+
91+
@media (prefers-color-scheme: dark) {
92+
:root {
93+
color: #f6f6f6;
94+
background-color: #2f2f2f;
95+
}
96+
97+
a:hover {
98+
color: #24c8db;
99+
}
100+
101+
input,
102+
button {
103+
color: #ffffff;
104+
background-color: #0f0f0f98;
105+
}
106+
button:active {
107+
background-color: #0f0f0f69;
108+
}
109+
}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
6+
"module": "ESNext",
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"noEmit": true,
15+
"jsx": "react-jsx",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true
22+
},
23+
"include": ["src"],
24+
"references": [{ "path": "./tsconfig.node.json" }]
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"skipLibCheck": true,
5+
"module": "ESNext",
6+
"moduleResolution": "bundler",
7+
"allowSyntheticDefaultImports": true
8+
},
9+
"include": ["vite.config.ts"]
10+
}

0 commit comments

Comments
 (0)