Compare commits
5 Commits
v1.0
...
c46ecaf3e2
| Author | SHA1 | Date | |
|---|---|---|---|
| c46ecaf3e2 | |||
| efb7ee0c28 | |||
| 5af3756e4f | |||
| 285ba5b3af | |||
| ba7a22e0fd |
99
.gitea/workflows/release.yml
Normal file
99
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
name: Build and Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Stamp version from tag
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$tag = "${{ github.ref_name }}"
|
||||||
|
$version = $tag.TrimStart('v')
|
||||||
|
Write-Host "Stamping version: $version"
|
||||||
|
|
||||||
|
# Update Cargo.toml (first occurrence of version = "x.y.z" in [package])
|
||||||
|
$cargo = Get-Content src-tauri\Cargo.toml -Raw
|
||||||
|
$cargo = $cargo -replace '(?m)^version = "\d+\.\d+\.\d+"', "version = `"$version`""
|
||||||
|
Set-Content src-tauri\Cargo.toml $cargo
|
||||||
|
|
||||||
|
# Update tauri.conf.json
|
||||||
|
$conf = Get-Content src-tauri\tauri.conf.json -Raw | ConvertFrom-Json
|
||||||
|
$conf.version = $version
|
||||||
|
$conf | ConvertTo-Json -Depth 10 | Set-Content src-tauri\tauri.conf.json
|
||||||
|
|
||||||
|
- name: Install npm dependencies
|
||||||
|
shell: powershell
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build C# sidecar
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
cd sidecar
|
||||||
|
dotnet publish -c Release -r win-x64 --self-contained
|
||||||
|
|
||||||
|
- name: Copy sidecar to Tauri binaries
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
New-Item -ItemType Directory -Force -Path src-tauri\binaries
|
||||||
|
$src = "sidecar\bin\Release\net8.0\win-x64\publish\asw-sidecar.exe"
|
||||||
|
$dst = "src-tauri\binaries\asw-sidecar-x86_64-pc-windows-msvc.exe"
|
||||||
|
Copy-Item $src $dst
|
||||||
|
Write-Host "Copied sidecar: $dst"
|
||||||
|
|
||||||
|
- name: Build Tauri app
|
||||||
|
shell: powershell
|
||||||
|
run: npm run tauri build
|
||||||
|
|
||||||
|
- name: Create Gitea Release
|
||||||
|
id: create_release
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$tag = "${{ github.ref_name }}"
|
||||||
|
$body = @{
|
||||||
|
tag_name = $tag
|
||||||
|
name = "Artificer's Scrollwork $tag"
|
||||||
|
body = "Automated release $tag"
|
||||||
|
draft = $false
|
||||||
|
prerelease = $false
|
||||||
|
} | ConvertTo-Json
|
||||||
|
|
||||||
|
$response = Invoke-RestMethod `
|
||||||
|
-Uri "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/Artificers-Scrollwork/releases" `
|
||||||
|
-Method Post `
|
||||||
|
-Headers @{
|
||||||
|
Authorization = "token ${{ secrets.RELEASE_TOKEN }}"
|
||||||
|
"Content-Type" = "application/json"
|
||||||
|
} `
|
||||||
|
-Body $body
|
||||||
|
|
||||||
|
$releaseId = $response.id
|
||||||
|
Write-Host "Created release ID: $releaseId"
|
||||||
|
Add-Content -Path $env:GITHUB_OUTPUT -Value "release_id=$releaseId"
|
||||||
|
|
||||||
|
- name: Upload MSI
|
||||||
|
shell: powershell
|
||||||
|
run: |
|
||||||
|
$releaseId = "${{ steps.create_release.outputs.release_id }}"
|
||||||
|
$msi = Get-ChildItem -Path "src-tauri\target\release\bundle\msi\*.msi" | Select-Object -First 1
|
||||||
|
|
||||||
|
Write-Host "MSI: $($msi.FullName)"
|
||||||
|
|
||||||
|
if (!(Test-Path $msi.FullName)) {
|
||||||
|
Write-Error "MSI not found in src-tauri\target\release\bundle\msi\"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
$uri = "https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/Artificers-Scrollwork/releases/$releaseId/assets?name=$($msi.Name)"
|
||||||
|
|
||||||
|
& curl.exe -X POST `
|
||||||
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" `
|
||||||
|
-F "attachment=@$($msi.FullName)" `
|
||||||
|
"$uri"
|
||||||
BIN
RVM_Beta1.0.zip
Normal file
BIN
RVM_Beta1.0.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
RVM_Beta1.0/RVM_Beta1.0/RVM安装与使用指南Beta1.0.pdf
Normal file
BIN
RVM_Beta1.0/RVM_Beta1.0/RVM安装与使用指南Beta1.0.pdf
Normal file
Binary file not shown.
12
RVM_Beta1.0/RVM_Beta1.0/index.html
Normal file
12
RVM_Beta1.0/RVM_Beta1.0/index.html
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>RimWorld Visual Mod Maker v50</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="root"></div>
|
||||||
|
<script type="module" src="/src/main.tsx"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1242
RVM_Beta1.0/RVM_Beta1.0/package-lock.json
generated
Normal file
1242
RVM_Beta1.0/RVM_Beta1.0/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
RVM_Beta1.0/RVM_Beta1.0/package.json
Normal file
22
RVM_Beta1.0/RVM_Beta1.0/package.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"name": "rimworld-visual-mod-maker-v50",
|
||||||
|
"version": "0.50.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"web": "vite --host 127.0.0.1",
|
||||||
|
"dev": "vite --host 127.0.0.1",
|
||||||
|
"build": "tsc && vite build"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"jszip": "3.10.1",
|
||||||
|
"react": "18.2.0",
|
||||||
|
"react-dom": "18.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/react": "18.2.66",
|
||||||
|
"@types/react-dom": "18.2.22",
|
||||||
|
"typescript": "5.4.5",
|
||||||
|
"vite": "5.4.21"
|
||||||
|
}
|
||||||
|
}
|
||||||
10
RVM_Beta1.0/RVM_Beta1.0/src/main.tsx
Normal file
10
RVM_Beta1.0/RVM_Beta1.0/src/main.tsx
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { createRoot } from "react-dom/client";
|
||||||
|
import App from "./ui/App";
|
||||||
|
import "./ui/styles.css";
|
||||||
|
|
||||||
|
createRoot(document.getElementById("root")!).render(
|
||||||
|
<React.StrictMode>
|
||||||
|
<App />
|
||||||
|
</React.StrictMode>
|
||||||
|
);
|
||||||
1936
RVM_Beta1.0/RVM_Beta1.0/src/ui/App.tsx
Normal file
1936
RVM_Beta1.0/RVM_Beta1.0/src/ui/App.tsx
Normal file
File diff suppressed because it is too large
Load Diff
78
RVM_Beta1.0/RVM_Beta1.0/src/ui/styles.css
Normal file
78
RVM_Beta1.0/RVM_Beta1.0/src/ui/styles.css
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
:root {
|
||||||
|
font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||||
|
color: #2e2419;
|
||||||
|
background: #eee8dc;
|
||||||
|
}
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body { margin: 0; }
|
||||||
|
button, input, select, textarea { font: inherit; }
|
||||||
|
button { border: 0; border-radius: 12px; padding: 10px 14px; background: #efe1cf; color: #3d2f20; font-weight: 700; cursor: pointer; }
|
||||||
|
button:hover { filter: brightness(.97); }
|
||||||
|
button.active, button.primary { background: #254834; color: white; }
|
||||||
|
.app { min-height: 100vh; }
|
||||||
|
header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 26px 38px; background: linear-gradient(90deg, #f7f4ed, #eadfcd); border-bottom: 1px solid #d9cab7; position: sticky; top: 0; z-index: 5; }
|
||||||
|
h1 { margin: 0; font-size: 28px; }
|
||||||
|
header p { margin: 8px 0 0; color: #765f48; }
|
||||||
|
code { background: #f3eadb; color: #613b18; border-radius: 8px; padding: 2px 6px; }
|
||||||
|
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
|
||||||
|
.toolbar label { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 14px; background: #fbf8f0; border: 1px solid #e3d2bd; }
|
||||||
|
main { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 96px); align-items: start; }
|
||||||
|
nav {
|
||||||
|
padding: 22px;
|
||||||
|
background: #faf7ef;
|
||||||
|
border-right: 1px solid #decfbd;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
position: sticky;
|
||||||
|
top: 106px;
|
||||||
|
height: calc(100vh - 106px);
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index: 4;
|
||||||
|
}
|
||||||
|
nav::-webkit-scrollbar { width: 8px; }
|
||||||
|
nav::-webkit-scrollbar-thumb { background: #d9cab7; border-radius: 999px; }
|
||||||
|
nav button { text-align: left; }
|
||||||
|
section { padding: 28px; }
|
||||||
|
.grid { display: grid; grid-template-columns: minmax(350px, 1fr) minmax(350px, 1fr); gap: 24px; align-items: start; }
|
||||||
|
.card { background: #fffaf3; border: 1px solid #deceb9; border-radius: 22px; padding: 22px; box-shadow: 0 18px 60px rgba(68,45,20,.08); margin-bottom: 22px; }
|
||||||
|
.card h2 { margin-top: 0; }
|
||||||
|
.field { display: grid; gap: 8px; margin: 14px 0; font-weight: 700; color: #5b452e; }
|
||||||
|
.field input, .field select, .field textarea, select { width: 100%; border: 1px solid #cdb89f; background: white; border-radius: 14px; padding: 12px; color: #22180e; }
|
||||||
|
.field textarea { min-height: 120px; resize: vertical; }
|
||||||
|
.check { display: flex; align-items: center; gap: 10px; margin: 14px 0; padding: 12px; background: #f3eadc; border-radius: 14px; font-weight: 700; }
|
||||||
|
.rowCard { padding: 16px; margin: 16px 0; border: 1px solid #e1d2bf; border-radius: 18px; background: #fffdf8; }
|
||||||
|
.textureGroup { background: #f7efe4; border-radius: 18px; padding: 14px; margin: 16px 0; }
|
||||||
|
.textureGroup h3 { margin: 0 0 10px; }
|
||||||
|
.drop { display: grid; gap: 8px; padding: 16px; border: 2px dashed #c9b69e; border-radius: 18px; background: rgba(255,255,255,.64); margin: 10px 0; min-height: 95px; align-content: center; cursor: pointer; }
|
||||||
|
.drop input { display: none; }
|
||||||
|
.drop.dragOver { background: #e6f4ea; border-color: #2d7a46; }
|
||||||
|
.drop span { color: #735a40; }
|
||||||
|
.asset { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed #deceb9; }
|
||||||
|
.errors { color: #aa2a1c; font-weight: 700; }
|
||||||
|
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
|
||||||
|
.chips label { background: #fff; border: 1px solid #e4d5c5; border-radius: 14px; padding: 12px; }
|
||||||
|
pre { white-space: pre-wrap; background: #f4eadb; border-radius: 14px; padding: 18px; }
|
||||||
|
@media (max-width: 900px) { main { grid-template-columns: 1fr; } nav { position: sticky; top: 0; height: auto; max-height: 45vh; overflow-y: auto; border-right: 0; border-bottom: 1px solid #decfbd; } .grid { grid-template-columns: 1fr; } header { align-items: flex-start; flex-direction: column; position: static; } }
|
||||||
|
.rowHeader { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
|
||||||
|
.rowHeader h3 { margin: 0; }
|
||||||
|
button.danger { background: #f4d6d1; color: #8a1f12; }
|
||||||
|
.rowLine { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
|
||||||
|
.selectedGenes { margin: 10px 0 16px; }
|
||||||
|
.chip { display: inline-flex; align-items: center; gap: 6px; background: #dff3e8; border-radius: 999px; padding: 6px 10px; font-weight: 700; }
|
||||||
|
.chip button { padding: 0 6px; border-radius: 999px; background: transparent; }
|
||||||
|
.geneCategory { margin: 16px 0; padding: 14px; border-radius: 18px; background: #f7efe4; }
|
||||||
|
.geneCategory h3 { margin: 0 0 10px; display: flex; justify-content: space-between; align-items: center; }
|
||||||
|
.geneOption { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
|
||||||
|
.geneOption span { display: grid; gap: 4px; }
|
||||||
|
.geneOption em { color: #765f48; font-style: normal; font-size: .92em; }
|
||||||
|
@media (max-width: 700px) { .rowLine { grid-template-columns: 1fr; } .rowHeader { align-items: stretch; flex-direction: column; } }
|
||||||
|
.toolbarInline { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
|
||||||
|
.accordionCard { padding: 0; overflow: hidden; }
|
||||||
|
.accordionHeader { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px; cursor: pointer; background: #f8efe2; border-bottom: 1px solid #e3d3c0; }
|
||||||
|
.accordionHeader:hover { filter: brightness(.985); }
|
||||||
|
.accordionHeader h3 { margin: 0 0 4px; }
|
||||||
|
.accordionHeader p { margin: 0; color: #765f48; font-size: .92rem; }
|
||||||
|
.accordionBody { padding: 16px; }
|
||||||
|
.hint { color: #765f48; font-size: .95rem; }
|
||||||
|
@media (max-width: 700px) { .accordionHeader { align-items: stretch; flex-direction: column; } .toolbarInline { width: 100%; } }
|
||||||
1
RVM_Beta1.0/RVM_Beta1.0/src/vite-env.d.ts
vendored
Normal file
1
RVM_Beta1.0/RVM_Beta1.0/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
declare module "*.css";
|
||||||
28
RVM_Beta1.0/RVM_Beta1.0/tsconfig.json
Normal file
28
RVM_Beta1.0/RVM_Beta1.0/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"lib": [
|
||||||
|
"DOM",
|
||||||
|
"DOM.Iterable",
|
||||||
|
"ES2020"
|
||||||
|
],
|
||||||
|
"allowJs": false,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"strict": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"ignoreDeprecations": "5.0"
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"references": []
|
||||||
|
}
|
||||||
77
RVM_Beta1.0/RVM_Beta1.0/vite.config.js
Normal file
77
RVM_Beta1.0/RVM_Beta1.0/vite.config.js
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import { defineConfig } from "vite";
|
||||||
|
import fs from "node:fs";
|
||||||
|
import path from "node:path";
|
||||||
|
|
||||||
|
function readRequestBody(req) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let body = "";
|
||||||
|
req.setEncoding("utf8");
|
||||||
|
req.on("data", (chunk) => { body += chunk; });
|
||||||
|
req.on("end", () => resolve(body));
|
||||||
|
req.on("error", reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendJson(res, code, payload) {
|
||||||
|
res.statusCode = code;
|
||||||
|
res.setHeader("Content-Type", "application/json; charset=utf-8");
|
||||||
|
res.end(JSON.stringify(payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sanitizeFileName(value) {
|
||||||
|
return String(value || "modmaker_log.txt")
|
||||||
|
.replace(/[^A-Za-z0-9._-]+/g, "_")
|
||||||
|
.replace(/^_+|_+$/g, "") || "modmaker_log.txt";
|
||||||
|
}
|
||||||
|
|
||||||
|
function modMakerLoggerPlugin() {
|
||||||
|
return {
|
||||||
|
name: "modmaker-terminal-and-file-logger",
|
||||||
|
configureServer(server) {
|
||||||
|
const logsDir = path.resolve(process.cwd(), "logs");
|
||||||
|
const sourceDir = path.resolve(process.cwd(), "source");
|
||||||
|
fs.mkdirSync(logsDir, { recursive: true });
|
||||||
|
fs.mkdirSync(sourceDir, { recursive: true });
|
||||||
|
|
||||||
|
server.middlewares.use(async (req, res, next) => {
|
||||||
|
const url = (req.url || "").split("?")[0];
|
||||||
|
if (req.method !== "POST" || (url !== "/__modmaker/log" && url !== "/__modmaker/export-log" && url !== "/__modmaker/export-source")) return next();
|
||||||
|
try {
|
||||||
|
const raw = await readRequestBody(req);
|
||||||
|
const payload = raw ? JSON.parse(raw) : {};
|
||||||
|
|
||||||
|
if (url === "/__modmaker/log") {
|
||||||
|
const entries = Array.isArray(payload.entries) ? payload.entries : [];
|
||||||
|
for (const entry of entries) {
|
||||||
|
console.log(`[ModMaker][${entry.timestamp || new Date().toISOString()}][${entry.scope || "project"}] ${entry.action || "Log"}: ${entry.detail || ""}`);
|
||||||
|
}
|
||||||
|
return sendJson(res, 200, { ok: true, count: entries.length });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url === "/__modmaker/export-log") {
|
||||||
|
const fileName = sanitizeFileName(payload.fileName);
|
||||||
|
const target = path.join(logsDir, fileName.endsWith(".txt") ? fileName : `${fileName}.txt`);
|
||||||
|
fs.writeFileSync(target, String(payload.content || ""), "utf8");
|
||||||
|
console.log(`[ModMaker] Full export log written: ${target}`);
|
||||||
|
return sendJson(res, 200, { ok: true, path: target });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (url === "/__modmaker/export-source") {
|
||||||
|
const fileName = sanitizeFileName(payload.fileName);
|
||||||
|
const target = path.join(sourceDir, fileName.endsWith(".json") ? fileName : `${fileName}.json`);
|
||||||
|
fs.writeFileSync(target, String(payload.content || ""), "utf8");
|
||||||
|
console.log(`[ModMaker] Project source written: ${target}`);
|
||||||
|
return sendJson(res, 200, { ok: true, path: target });
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("[ModMaker] Logger endpoint failed:", error);
|
||||||
|
return sendJson(res, 500, { ok: false, error: String(error) });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [modMakerLoggerPlugin()]
|
||||||
|
});
|
||||||
@@ -25,6 +25,8 @@ image = { version = "0.25", features = ["dds"] }
|
|||||||
once_cell = "1"
|
once_cell = "1"
|
||||||
tokio = { version = "1", features = ["full"] }
|
tokio = { version = "1", features = ["full"] }
|
||||||
walkdir = "2"
|
walkdir = "2"
|
||||||
|
reqwest = { version = "0.12", features = ["json", "stream"] }
|
||||||
|
futures-util = "0.3"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
custom-protocol = ["tauri/custom-protocol"]
|
custom-protocol = ["tauri/custom-protocol"]
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ pub mod asset_commands;
|
|||||||
pub mod config_commands;
|
pub mod config_commands;
|
||||||
pub mod gump_commands;
|
pub mod gump_commands;
|
||||||
pub mod script_commands;
|
pub mod script_commands;
|
||||||
|
pub mod update_commands;
|
||||||
|
|||||||
192
src-tauri/src/commands/update_commands.rs
Normal file
192
src-tauri/src/commands/update_commands.rs
Normal file
@@ -0,0 +1,192 @@
|
|||||||
|
use futures_util::StreamExt;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::io::Write;
|
||||||
|
use tauri::{AppHandle, Emitter};
|
||||||
|
|
||||||
|
const GITEA_API: &str =
|
||||||
|
"https://gitea.whitlocktech.com/api/v1/repos/whitlocktech/Artificers-Scrollwork/releases";
|
||||||
|
|
||||||
|
const CURRENT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
|
// ── Gitea API types ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize)]
|
||||||
|
struct GiteaRelease {
|
||||||
|
tag_name: String,
|
||||||
|
body: String,
|
||||||
|
assets: Vec<GiteaAsset>,
|
||||||
|
#[serde(default)]
|
||||||
|
prerelease: bool,
|
||||||
|
#[serde(default)]
|
||||||
|
draft: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Deserialize)]
|
||||||
|
struct GiteaAsset {
|
||||||
|
name: String,
|
||||||
|
size: u64,
|
||||||
|
browser_download_url: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Public types returned to the frontend ────────────────────────────────────
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct UpdateInfo {
|
||||||
|
pub available: bool,
|
||||||
|
pub latest_version: String,
|
||||||
|
pub current_version: String,
|
||||||
|
pub release_notes: String,
|
||||||
|
pub download_url: String,
|
||||||
|
pub asset_name: String,
|
||||||
|
/// File size in bytes (0 if unknown)
|
||||||
|
pub asset_size: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Version helpers ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
fn parse_semver(v: &str) -> (u32, u32, u32) {
|
||||||
|
let v = v.trim_start_matches('v');
|
||||||
|
let mut parts = v.split('.').filter_map(|p| p.parse::<u32>().ok());
|
||||||
|
(
|
||||||
|
parts.next().unwrap_or(0),
|
||||||
|
parts.next().unwrap_or(0),
|
||||||
|
parts.next().unwrap_or(0),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_newer(tag: &str, current: &str) -> bool {
|
||||||
|
parse_semver(tag) > parse_semver(current)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Commands ─────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
/// Check the Gitea releases API for a newer version.
|
||||||
|
/// Returns `UpdateInfo` with `available: true` when a newer MSI release exists.
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn check_for_update() -> Result<UpdateInfo, String> {
|
||||||
|
let client = reqwest::Client::builder()
|
||||||
|
.user_agent(format!(
|
||||||
|
"ArtificersScrollwork/{CURRENT_VERSION} (updater)"
|
||||||
|
))
|
||||||
|
.timeout(std::time::Duration::from_secs(15))
|
||||||
|
.build()
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
|
let releases: Vec<GiteaRelease> = client
|
||||||
|
.get(format!("{GITEA_API}?limit=10&page=1"))
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Network error: {e}"))?
|
||||||
|
.json()
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Failed to parse release data: {e}"))?;
|
||||||
|
|
||||||
|
// Pick the latest non-draft, non-prerelease that ships an MSI
|
||||||
|
let release = releases
|
||||||
|
.iter()
|
||||||
|
.find(|r| !r.draft && !r.prerelease && r.assets.iter().any(|a| a.name.ends_with(".msi")));
|
||||||
|
|
||||||
|
let Some(release) = release else {
|
||||||
|
return Ok(UpdateInfo {
|
||||||
|
available: false,
|
||||||
|
latest_version: CURRENT_VERSION.to_string(),
|
||||||
|
current_version: CURRENT_VERSION.to_string(),
|
||||||
|
release_notes: String::new(),
|
||||||
|
download_url: String::new(),
|
||||||
|
asset_name: String::new(),
|
||||||
|
asset_size: 0,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
let msi = release
|
||||||
|
.assets
|
||||||
|
.iter()
|
||||||
|
.find(|a| a.name.ends_with(".msi"))
|
||||||
|
.unwrap(); // safe: filtered above
|
||||||
|
|
||||||
|
Ok(UpdateInfo {
|
||||||
|
available: is_newer(&release.tag_name, CURRENT_VERSION),
|
||||||
|
latest_version: release.tag_name.trim_start_matches('v').to_string(),
|
||||||
|
current_version: CURRENT_VERSION.to_string(),
|
||||||
|
release_notes: release.body.clone(),
|
||||||
|
download_url: msi.browser_download_url.clone(),
|
||||||
|
asset_name: msi.name.clone(),
|
||||||
|
asset_size: msi.size,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Download the MSI to the system temp directory, emitting `update-progress`
|
||||||
|
/// events as chunks arrive, then launch the installer via msiexec.
|
||||||
|
///
|
||||||
|
/// The frontend should listen for `update-progress` events:
|
||||||
|
/// `{ downloaded: number, total: number }`
|
||||||
|
///
|
||||||
|
/// After this returns Ok(()), the installer will be running and the user
|
||||||
|
/// can follow the wizard. The app does NOT auto-close; the installer handles it.
|
||||||
|
#[tauri::command]
|
||||||
|
pub async fn download_and_install_update(
|
||||||
|
app: AppHandle,
|
||||||
|
download_url: String,
|
||||||
|
asset_name: String,
|
||||||
|
) -> Result<(), String> {
|
||||||
|
let client = reqwest::Client::builder()
|
||||||
|
.user_agent(format!(
|
||||||
|
"ArtificersScrollwork/{CURRENT_VERSION} (updater)"
|
||||||
|
))
|
||||||
|
.timeout(std::time::Duration::from_secs(300))
|
||||||
|
.build()
|
||||||
|
.map_err(|e| e.to_string())?;
|
||||||
|
|
||||||
|
let response = client
|
||||||
|
.get(&download_url)
|
||||||
|
.send()
|
||||||
|
.await
|
||||||
|
.map_err(|e| format!("Download request failed: {e}"))?;
|
||||||
|
|
||||||
|
if !response.status().is_success() {
|
||||||
|
return Err(format!(
|
||||||
|
"Download failed with status {}",
|
||||||
|
response.status()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let total = response.content_length().unwrap_or(0);
|
||||||
|
|
||||||
|
// Write to temp dir
|
||||||
|
let installer_path = std::env::temp_dir().join(&asset_name);
|
||||||
|
let mut file =
|
||||||
|
std::fs::File::create(&installer_path).map_err(|e| format!("Cannot create temp file: {e}"))?;
|
||||||
|
|
||||||
|
let mut downloaded = 0u64;
|
||||||
|
let mut stream = response.bytes_stream();
|
||||||
|
|
||||||
|
while let Some(chunk) = stream.next().await {
|
||||||
|
let chunk = chunk.map_err(|e| format!("Download interrupted: {e}"))?;
|
||||||
|
file.write_all(&chunk)
|
||||||
|
.map_err(|e| format!("Write error: {e}"))?;
|
||||||
|
downloaded += chunk.len() as u64;
|
||||||
|
let _ = app.emit(
|
||||||
|
"update-progress",
|
||||||
|
serde_json::json!({ "downloaded": downloaded, "total": total }),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
drop(file); // ensure file handle is closed before launching
|
||||||
|
|
||||||
|
// Launch installer — Windows opens .msi files with msiexec automatically
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
{
|
||||||
|
std::process::Command::new("msiexec")
|
||||||
|
.args(["/i", &installer_path.to_string_lossy().to_string()])
|
||||||
|
.spawn()
|
||||||
|
.map_err(|e| format!("Failed to launch installer: {e}"))?;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
{
|
||||||
|
// Fallback for non-Windows (future proofing)
|
||||||
|
opener::open(&installer_path).map_err(|e| format!("Failed to open installer: {e}"))?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -19,6 +19,9 @@ pub fn run() {
|
|||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.invoke_handler(tauri::generate_handler![
|
.invoke_handler(tauri::generate_handler![
|
||||||
|
// Updater
|
||||||
|
commands::update_commands::check_for_update,
|
||||||
|
commands::update_commands::download_and_install_update,
|
||||||
// Config
|
// Config
|
||||||
commands::config_commands::get_config,
|
commands::config_commands::get_config,
|
||||||
commands::config_commands::set_config,
|
commands::config_commands::set_config,
|
||||||
|
|||||||
@@ -31,10 +31,6 @@
|
|||||||
"externalBin": [
|
"externalBin": [
|
||||||
"binaries/asw-sidecar"
|
"binaries/asw-sidecar"
|
||||||
],
|
],
|
||||||
"resources": {
|
|
||||||
"../UO artwork": "UO artwork",
|
|
||||||
"../UO Gumps": "UO Gumps"
|
|
||||||
},
|
|
||||||
"icon": [
|
"icon": [
|
||||||
"icons/32x32.png",
|
"icons/32x32.png",
|
||||||
"icons/128x128.png",
|
"icons/128x128.png",
|
||||||
|
|||||||
22
src/App.tsx
22
src/App.tsx
@@ -1,12 +1,14 @@
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { useAppStore } from './store/appStore';
|
import { useAppStore, applyTypographyVars, DEFAULT_FONT_FAMILY, DEFAULT_TEXT_COLOR, DEFAULT_FONT_SIZE_INDEX_REAL } from './store/appStore';
|
||||||
import AppShell from './components/layout/AppShell';
|
import AppShell from './components/layout/AppShell';
|
||||||
import ConfigScreen from './components/config/ConfigScreen';
|
import ConfigScreen from './components/config/ConfigScreen';
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const { isConfigured, setIsConfigured, setUoRoot, setServuoScripts, setCenterMode } =
|
const {
|
||||||
useAppStore();
|
isConfigured, setIsConfigured, setUoRoot, setServuoScripts, setCenterMode,
|
||||||
|
setFontFamily, setFontSizeIndex, setTextColor,
|
||||||
|
} = useAppStore();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function loadConfig() {
|
async function loadConfig() {
|
||||||
@@ -14,6 +16,20 @@ export default function App() {
|
|||||||
const uo = await invoke<string | null>('get_config', { key: 'uo_root' });
|
const uo = await invoke<string | null>('get_config', { key: 'uo_root' });
|
||||||
const scripts = await invoke<string | null>('get_config', { key: 'seruo_scripts' });
|
const scripts = await invoke<string | null>('get_config', { key: 'seruo_scripts' });
|
||||||
|
|
||||||
|
// Load typography settings (non-fatal — fall back to defaults)
|
||||||
|
const fontFamily = await invoke<string | null>('get_config', { key: 'font_family' }).catch(() => null);
|
||||||
|
const fontSizeIdx = await invoke<string | null>('get_config', { key: 'font_size_index' }).catch(() => null);
|
||||||
|
const textColor = await invoke<string | null>('get_config', { key: 'text_color' }).catch(() => null);
|
||||||
|
|
||||||
|
const resolvedFamily = fontFamily ?? DEFAULT_FONT_FAMILY;
|
||||||
|
const resolvedIdx = fontSizeIdx != null ? parseInt(fontSizeIdx, 10) : DEFAULT_FONT_SIZE_INDEX_REAL;
|
||||||
|
const resolvedColor = textColor ?? DEFAULT_TEXT_COLOR;
|
||||||
|
|
||||||
|
setFontFamily(resolvedFamily);
|
||||||
|
setFontSizeIndex(isNaN(resolvedIdx) ? DEFAULT_FONT_SIZE_INDEX_REAL : resolvedIdx);
|
||||||
|
setTextColor(resolvedColor);
|
||||||
|
applyTypographyVars(resolvedFamily, isNaN(resolvedIdx) ? DEFAULT_FONT_SIZE_INDEX_REAL : resolvedIdx, resolvedColor);
|
||||||
|
|
||||||
if (uo && scripts) {
|
if (uo && scripts) {
|
||||||
setUoRoot(uo);
|
setUoRoot(uo);
|
||||||
setServuoScripts(scripts);
|
setServuoScripts(scripts);
|
||||||
|
|||||||
@@ -14,14 +14,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
font-size: 16px;
|
font-size: 1em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.id {
|
.id {
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
.loading,
|
.loading,
|
||||||
.error {
|
.error {
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,13 +22,13 @@
|
|||||||
|
|
||||||
.id {
|
.id {
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
min-width: 48px;
|
min-width: 48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-top: 1px solid var(--border);
|
border-top: 1px solid var(--border);
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
.empty {
|
.empty {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
.screen {
|
.screen {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: flex-start;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background: var(--bg-base);
|
background: var(--bg-base);
|
||||||
padding: 40px;
|
padding: 40px;
|
||||||
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
@@ -19,13 +20,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 22px;
|
font-size: 1.375em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.06em;
|
letter-spacing: 0.06em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subtitle {
|
.subtitle {
|
||||||
font-size: 14px;
|
font-size: 0.875em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
margin-top: -16px;
|
margin-top: -16px;
|
||||||
}
|
}
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
letter-spacing: 0.06em;
|
letter-spacing: 0.06em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -52,7 +53,7 @@
|
|||||||
.pathInput {
|
.pathInput {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
@@ -60,7 +61,7 @@
|
|||||||
background: var(--bg-elevated);
|
background: var(--bg-elevated);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
transition: border-color 0.15s, color 0.15s;
|
transition: border-color 0.15s, color 0.15s;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
@@ -104,7 +105,7 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 3px;
|
gap: 3px;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,6 +127,141 @@
|
|||||||
background: var(--accent-red);
|
background: var(--accent-red);
|
||||||
border: 1px solid #b04040;
|
border: 1px solid #b04040;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
color: #ffd0d0;
|
color: #ffd0d0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Appearance section ─────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.sectionDivider {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionDivider::before,
|
||||||
|
.sectionDivider::after {
|
||||||
|
content: '';
|
||||||
|
flex: 1;
|
||||||
|
height: 1px;
|
||||||
|
background: var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sectionLabel {
|
||||||
|
font-family: 'Cinzel', serif;
|
||||||
|
font-size: 0.6875em;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
text-transform: uppercase;
|
||||||
|
color: var(--text-muted);
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select {
|
||||||
|
width: 100%;
|
||||||
|
padding: 6px 10px;
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
color: var(--text-primary);
|
||||||
|
font-family: 'EB Garamond', Georgia, serif;
|
||||||
|
font-size: 0.875em;
|
||||||
|
border-radius: 3px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.select:focus {
|
||||||
|
border-color: var(--border-accent);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizeRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizeBtn {
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 1em;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizeBtn:disabled {
|
||||||
|
opacity: 0.3;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizeDisplay {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizePip {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--border-accent);
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.15s, transform 0.15s;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizePip:hover {
|
||||||
|
background: var(--accent-gold);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizePipActive {
|
||||||
|
background: var(--accent-gold-bright);
|
||||||
|
transform: scale(1.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.fontSizeLabel {
|
||||||
|
margin-left: auto;
|
||||||
|
font-family: 'JetBrains Mono', monospace;
|
||||||
|
font-size: 0.75em;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
min-width: 36px;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colorRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colorPicker {
|
||||||
|
width: 40px;
|
||||||
|
height: 32px;
|
||||||
|
padding: 2px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colorPicker:focus {
|
||||||
|
border-color: var(--border-accent);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.colorHex {
|
||||||
|
font-family: 'JetBrains Mono', monospace;
|
||||||
|
font-size: 0.8125em;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
min-width: 64px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
import { open } from '@tauri-apps/plugin-dialog';
|
import { open } from '@tauri-apps/plugin-dialog';
|
||||||
import { useAppStore } from '../../store/appStore';
|
import {
|
||||||
|
useAppStore,
|
||||||
|
FONT_SIZE_VALUES,
|
||||||
|
FONT_FAMILY_OPTIONS,
|
||||||
|
} from '../../store/appStore';
|
||||||
import styles from './ConfigScreen.module.css';
|
import styles from './ConfigScreen.module.css';
|
||||||
|
|
||||||
interface ValidationResult {
|
interface ValidationResult {
|
||||||
@@ -15,7 +19,11 @@ interface Props {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function ConfigScreen({ onDone }: Props) {
|
export default function ConfigScreen({ onDone }: Props) {
|
||||||
const { uoRoot, servuoScripts, setUoRoot, setServuoScripts, setIsConfigured } = useAppStore();
|
const {
|
||||||
|
uoRoot, servuoScripts, setUoRoot, setServuoScripts, setIsConfigured,
|
||||||
|
fontFamily, fontSizeIndex, textColor,
|
||||||
|
setFontFamily, setFontSizeIndex, setTextColor,
|
||||||
|
} = useAppStore();
|
||||||
const [uoResults, setUoResults] = useState<ValidationResult[]>([]);
|
const [uoResults, setUoResults] = useState<ValidationResult[]>([]);
|
||||||
const [scriptResults, setScriptResults] = useState<ValidationResult[]>([]);
|
const [scriptResults, setScriptResults] = useState<ValidationResult[]>([]);
|
||||||
const [saving, setSaving] = useState(false);
|
const [saving, setSaving] = useState(false);
|
||||||
@@ -43,6 +51,9 @@ export default function ConfigScreen({ onDone }: Props) {
|
|||||||
try {
|
try {
|
||||||
await invoke('set_config', { key: 'uo_root', value: uoRoot });
|
await invoke('set_config', { key: 'uo_root', value: uoRoot });
|
||||||
await invoke('set_config', { key: 'seruo_scripts', value: servuoScripts });
|
await invoke('set_config', { key: 'seruo_scripts', value: servuoScripts });
|
||||||
|
await invoke('set_config', { key: 'font_family', value: fontFamily });
|
||||||
|
await invoke('set_config', { key: 'font_size_index', value: String(fontSizeIndex) });
|
||||||
|
await invoke('set_config', { key: 'text_color', value: textColor });
|
||||||
setIsConfigured(true);
|
setIsConfigured(true);
|
||||||
onDone?.();
|
onDone?.();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -52,6 +63,13 @@ export default function ConfigScreen({ onDone }: Props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleFontSizeDown() {
|
||||||
|
if (fontSizeIndex > 0) setFontSizeIndex(fontSizeIndex - 1);
|
||||||
|
}
|
||||||
|
function handleFontSizeUp() {
|
||||||
|
if (fontSizeIndex < FONT_SIZE_VALUES.length - 1) setFontSizeIndex(fontSizeIndex + 1);
|
||||||
|
}
|
||||||
|
|
||||||
const canSave =
|
const canSave =
|
||||||
uoRoot &&
|
uoRoot &&
|
||||||
servuoScripts &&
|
servuoScripts &&
|
||||||
@@ -94,6 +112,71 @@ export default function ConfigScreen({ onDone }: Props) {
|
|||||||
{scriptResults.length > 0 && <ValidationList results={scriptResults} />}
|
{scriptResults.length > 0 && <ValidationList results={scriptResults} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* ── Appearance ────────────────────────────────────────────── */}
|
||||||
|
<div className={styles.sectionDivider}>
|
||||||
|
<span className={styles.sectionLabel}>Appearance</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.field}>
|
||||||
|
<label className={styles.label}>Font Family</label>
|
||||||
|
<select
|
||||||
|
className={styles.select}
|
||||||
|
value={fontFamily}
|
||||||
|
onChange={(e) => setFontFamily(e.target.value)}
|
||||||
|
>
|
||||||
|
{FONT_FAMILY_OPTIONS.map((opt) => (
|
||||||
|
<option key={opt.value} value={opt.value}>{opt.label}</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.field}>
|
||||||
|
<label className={styles.label}>Font Size</label>
|
||||||
|
<div className={styles.fontSizeRow}>
|
||||||
|
<button
|
||||||
|
className={`${styles.btn} ${styles.fontSizeBtn}`}
|
||||||
|
onClick={handleFontSizeDown}
|
||||||
|
disabled={fontSizeIndex === 0}
|
||||||
|
title="Decrease font size"
|
||||||
|
>−</button>
|
||||||
|
<div className={styles.fontSizeDisplay}>
|
||||||
|
{FONT_SIZE_VALUES.map((sz, i) => (
|
||||||
|
<button
|
||||||
|
key={sz}
|
||||||
|
className={`${styles.fontSizePip} ${i === fontSizeIndex ? styles.fontSizePipActive : ''}`}
|
||||||
|
onClick={() => setFontSizeIndex(i)}
|
||||||
|
title={`${sz}px`}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
<span className={styles.fontSizeLabel}>{FONT_SIZE_VALUES[fontSizeIndex]}px</span>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
className={`${styles.btn} ${styles.fontSizeBtn}`}
|
||||||
|
onClick={handleFontSizeUp}
|
||||||
|
disabled={fontSizeIndex === FONT_SIZE_VALUES.length - 1}
|
||||||
|
title="Increase font size"
|
||||||
|
>+</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className={styles.field}>
|
||||||
|
<label className={styles.label}>Text Color</label>
|
||||||
|
<div className={styles.colorRow}>
|
||||||
|
<input
|
||||||
|
type="color"
|
||||||
|
className={styles.colorPicker}
|
||||||
|
value={textColor}
|
||||||
|
onChange={(e) => setTextColor(e.target.value)}
|
||||||
|
/>
|
||||||
|
<span className={styles.colorHex}>{textColor}</span>
|
||||||
|
<button
|
||||||
|
className={`${styles.btn} ${styles.btnSecondary}`}
|
||||||
|
onClick={() => setTextColor('#d4c49a')}
|
||||||
|
title="Reset to default parchment color"
|
||||||
|
>Reset</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{error && <div className={styles.error}>{error}</div>}
|
{error && <div className={styles.error}>{error}</div>}
|
||||||
|
|
||||||
<div className={styles.actions}>
|
<div className={styles.actions}>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.08em;
|
letter-spacing: 0.08em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hint {
|
.hint {
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -27,12 +27,12 @@
|
|||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.input {
|
.input {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
.methodLabel {
|
.methodLabel {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
background: none;
|
background: none;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: border-color 0.15s, color 0.15s;
|
transition: border-color 0.15s, color 0.15s;
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 14px;
|
font-size: 0.875em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
padding: 40px;
|
padding: 40px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -77,12 +77,12 @@
|
|||||||
.errorTitle {
|
.errorTitle {
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
color: #cc6666;
|
color: #cc6666;
|
||||||
font-size: 16px;
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.errorMsg {
|
.errorMsg {
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
@@ -94,6 +94,6 @@
|
|||||||
border: 1px solid var(--border-accent);
|
border: 1px solid var(--border-accent);
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
border-right: 1px solid var(--border);
|
border-right: 1px solid var(--border);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: color 0.15s, background 0.15s;
|
transition: color 0.15s, background 0.15s;
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
background: var(--bg-elevated);
|
background: var(--bg-elevated);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
padding: 2px 7px;
|
padding: 2px 7px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.count {
|
.count {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
padding: 4px 10px;
|
padding: 4px 10px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
.itemId {
|
.itemId {
|
||||||
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
min-width: 48px;
|
min-width: 48px;
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
.itemName {
|
.itemName {
|
||||||
font-family: 'EB Garamond', serif;
|
font-family: 'EB Garamond', serif;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -127,7 +127,7 @@
|
|||||||
|
|
||||||
.itemPath {
|
.itemPath {
|
||||||
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
||||||
font-size: 9px;
|
font-size: 0.5625em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -139,12 +139,12 @@
|
|||||||
padding: 16px;
|
padding: 16px;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
color: var(--accent-red);
|
color: var(--accent-red);
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
.name {
|
.name {
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 16px;
|
font-size: 1em;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
.id {
|
.id {
|
||||||
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
background: var(--bg-elevated);
|
background: var(--bg-elevated);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
.loading {
|
.loading {
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +79,6 @@
|
|||||||
|
|
||||||
.meta {
|
.meta {
|
||||||
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
.className {
|
.className {
|
||||||
display: block;
|
display: block;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 20px;
|
font-size: 1.25em;
|
||||||
color: var(--accent-gold-bright);
|
color: var(--accent-gold-bright);
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
.friendlyName {
|
.friendlyName {
|
||||||
display: block;
|
display: block;
|
||||||
font-family: 'EB Garamond', serif;
|
font-family: 'EB Garamond', serif;
|
||||||
font-size: 14px;
|
font-size: 0.875em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
|
|
||||||
.label {
|
.label {
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
letter-spacing: 0.1em;
|
letter-spacing: 0.1em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
.filepath {
|
.filepath {
|
||||||
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
font-family: 'JetBrains Mono', 'Fira Code', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
background: var(--bg-elevated);
|
background: var(--bg-elevated);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
@@ -73,14 +73,14 @@
|
|||||||
border: 1px solid var(--border-accent);
|
border: 1px solid var(--border-accent);
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
padding: 3px 9px;
|
padding: 3px 9px;
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notes {
|
.notes {
|
||||||
font-family: 'EB Garamond', serif;
|
font-family: 'EB Garamond', serif;
|
||||||
font-size: 14px;
|
font-size: 0.875em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
@@ -92,5 +92,5 @@
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 15px;
|
font-size: 0.9375em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
padding: 4px 10px;
|
padding: 4px 10px;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
transition: border-color 0.15s, color 0.15s;
|
transition: border-color 0.15s, color 0.15s;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import LeftPanel from './LeftPanel';
|
|||||||
import CenterPanel from './CenterPanel';
|
import CenterPanel from './CenterPanel';
|
||||||
import RightPanel from './RightPanel';
|
import RightPanel from './RightPanel';
|
||||||
import ConfigScreen from '../config/ConfigScreen';
|
import ConfigScreen from '../config/ConfigScreen';
|
||||||
|
import UpdateChecker from '../update/UpdateChecker';
|
||||||
import styles from './AppShell.module.css';
|
import styles from './AppShell.module.css';
|
||||||
|
|
||||||
export default function AppShell() {
|
export default function AppShell() {
|
||||||
@@ -46,6 +47,7 @@ export default function AppShell() {
|
|||||||
<header className={styles.header}>
|
<header className={styles.header}>
|
||||||
<span className={`${styles.title} font-cinzel`}>Artificer's Scrollwork</span>
|
<span className={`${styles.title} font-cinzel`}>Artificer's Scrollwork</span>
|
||||||
<div className={styles.headerActions}>
|
<div className={styles.headerActions}>
|
||||||
|
<UpdateChecker />
|
||||||
<button
|
<button
|
||||||
className={styles.headerBtn}
|
className={styles.headerBtn}
|
||||||
onClick={handleIndexAssets}
|
onClick={handleIndexAssets}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 14px;
|
font-size: 0.875em;
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
border: none;
|
border: none;
|
||||||
border-right: 1px solid var(--border);
|
border-right: 1px solid var(--border);
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
transition: background 0.15s, color 0.15s;
|
transition: background 0.15s, color 0.15s;
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
.searchInput {
|
.searchInput {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
@@ -59,6 +59,6 @@
|
|||||||
.placeholder {
|
.placeholder {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sectionTitle {
|
.sectionTitle {
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.08em;
|
letter-spacing: 0.08em;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
.propRow {
|
.propRow {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.propLabel {
|
.propLabel {
|
||||||
@@ -40,11 +40,11 @@
|
|||||||
.propValue {
|
.propValue {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.subTitle {
|
.subTitle {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
letter-spacing: 0.06em;
|
letter-spacing: 0.06em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -53,6 +53,6 @@
|
|||||||
|
|
||||||
.empty {
|
.empty {
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.className {
|
.className {
|
||||||
font-size: 18px;
|
font-size: 1.125em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag {
|
.tag {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
padding: 2px 6px;
|
padding: 2px 6px;
|
||||||
border: 1px solid #445;
|
border: 1px solid #445;
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
.filePath {
|
.filePath {
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
margin-top: 4px;
|
margin-top: 4px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sectionTitle {
|
.sectionTitle {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
letter-spacing: 0.08em;
|
letter-spacing: 0.08em;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -73,14 +73,14 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chainItem {
|
.chainItem {
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.arrow {
|
.arrow {
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.interfaces {
|
.interfaces {
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
margin-top: 6px;
|
margin-top: 6px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
.loading {
|
.loading {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +128,7 @@
|
|||||||
gap: 6px;
|
gap: 6px;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.returnType {
|
.returnType {
|
||||||
@@ -142,11 +142,11 @@
|
|||||||
|
|
||||||
.params {
|
.params {
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 11px;
|
font-size: 0.6875em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modBadge {
|
.modBadge {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
padding: 1px 5px;
|
padding: 1px 5px;
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
color: var(--text-secondary);
|
color: var(--text-secondary);
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
letter-spacing: 0.04em;
|
letter-spacing: 0.04em;
|
||||||
transition: background 0.1s, color 0.1s;
|
transition: background 0.1s, color 0.1s;
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nsChevron {
|
.nsChevron {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--accent-gold);
|
color: var(--accent-gold);
|
||||||
min-width: 10px;
|
min-width: 10px;
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.nsCount {
|
.nsCount {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
.className {
|
.className {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@@ -80,13 +80,13 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.classNs {
|
.classNs {
|
||||||
font-size: 10px;
|
font-size: 0.625em;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.badge {
|
.badge {
|
||||||
font-size: 9px;
|
font-size: 0.5625em;
|
||||||
font-family: 'Cinzel', serif;
|
font-family: 'Cinzel', serif;
|
||||||
padding: 1px 4px;
|
padding: 1px 4px;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
@@ -116,7 +116,7 @@
|
|||||||
.empty {
|
.empty {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: 13px;
|
font-size: 0.8125em;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
}
|
}
|
||||||
@@ -124,6 +124,6 @@
|
|||||||
.error {
|
.error {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
color: #ff8080;
|
color: #ff8080;
|
||||||
font-size: 12px;
|
font-size: 0.75em;
|
||||||
font-family: 'JetBrains Mono', monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
}
|
}
|
||||||
|
|||||||
147
src/components/update/UpdateChecker.module.css
Normal file
147
src/components/update/UpdateChecker.module.css
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
.checkBtn {
|
||||||
|
padding: 4px 10px;
|
||||||
|
background: none;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 0.8125em;
|
||||||
|
font-family: 'Cinzel', serif;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
transition: border-color 0.15s, color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.checkBtn:hover {
|
||||||
|
border-color: var(--border-accent);
|
||||||
|
color: var(--accent-gold);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Status text ─────────────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.status {
|
||||||
|
font-size: 0.75em;
|
||||||
|
font-family: 'Cinzel', serif;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
padding: 4px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ok {
|
||||||
|
color: var(--accent-green, #4a8a4a);
|
||||||
|
}
|
||||||
|
|
||||||
|
.err {
|
||||||
|
color: var(--accent-red, #8b3a3a);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Download progress ───────────────────────────────────────────── */
|
||||||
|
|
||||||
|
.downloadRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
padding: 4px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloadLabel {
|
||||||
|
font-size: 0.75em;
|
||||||
|
font-family: 'JetBrains Mono', monospace;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
white-space: nowrap;
|
||||||
|
min-width: 160px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progressBar {
|
||||||
|
width: 120px;
|
||||||
|
height: 6px;
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 3px;
|
||||||
|
overflow: hidden;
|
||||||
|
flex-shrink: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progressFill {
|
||||||
|
height: 100%;
|
||||||
|
background: var(--accent-gold);
|
||||||
|
transition: width 0.15s ease;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Update available banner ─────────────────────────────────────── */
|
||||||
|
|
||||||
|
.banner {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
border: 1px solid var(--border-accent);
|
||||||
|
background: var(--bg-elevated);
|
||||||
|
max-width: 420px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bannerRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
padding: 4px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bannerTitle {
|
||||||
|
font-size: 0.8125em;
|
||||||
|
font-family: 'Cinzel', serif;
|
||||||
|
color: var(--accent-gold-bright);
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
flex: 1;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.installBtn {
|
||||||
|
padding: 3px 10px;
|
||||||
|
background: var(--accent-gold);
|
||||||
|
border: 1px solid var(--accent-gold);
|
||||||
|
color: var(--bg-base);
|
||||||
|
font-family: 'Cinzel', serif;
|
||||||
|
font-size: 0.75em;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
transition: background 0.15s;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.installBtn:hover {
|
||||||
|
background: var(--accent-gold-bright);
|
||||||
|
border-color: var(--accent-gold-bright);
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggleBtn,
|
||||||
|
.dismissBtn {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
font-size: 0.75em;
|
||||||
|
padding: 2px 4px;
|
||||||
|
line-height: 1;
|
||||||
|
transition: color 0.15s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.toggleBtn:hover,
|
||||||
|
.dismissBtn:hover {
|
||||||
|
color: var(--accent-gold);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Release notes dropdown ──────────────────────────────────────── */
|
||||||
|
|
||||||
|
.notes {
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
padding: 8px 10px;
|
||||||
|
max-height: 140px;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notesText {
|
||||||
|
font-family: 'JetBrains Mono', monospace;
|
||||||
|
font-size: 0.6875em;
|
||||||
|
color: var(--text-secondary);
|
||||||
|
white-space: pre-wrap;
|
||||||
|
word-break: break-word;
|
||||||
|
line-height: 1.5;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
173
src/components/update/UpdateChecker.tsx
Normal file
173
src/components/update/UpdateChecker.tsx
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
|
import { listen } from '@tauri-apps/api/event';
|
||||||
|
import styles from './UpdateChecker.module.css';
|
||||||
|
|
||||||
|
interface UpdateInfo {
|
||||||
|
available: boolean;
|
||||||
|
latest_version: string;
|
||||||
|
current_version: string;
|
||||||
|
release_notes: string;
|
||||||
|
download_url: string;
|
||||||
|
asset_name: string;
|
||||||
|
asset_size: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ProgressEvent {
|
||||||
|
downloaded: number;
|
||||||
|
total: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
type State =
|
||||||
|
| { kind: 'idle' }
|
||||||
|
| { kind: 'checking' }
|
||||||
|
| { kind: 'up_to_date' }
|
||||||
|
| { kind: 'error'; message: string }
|
||||||
|
| { kind: 'available'; info: UpdateInfo }
|
||||||
|
| { kind: 'downloading'; downloaded: number; total: number }
|
||||||
|
| { kind: 'launching' };
|
||||||
|
|
||||||
|
function fmtBytes(n: number): string {
|
||||||
|
if (n === 0) return '?';
|
||||||
|
if (n < 1024 * 1024) return `${(n / 1024).toFixed(0)} KB`;
|
||||||
|
return `${(n / (1024 * 1024)).toFixed(1)} MB`;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function UpdateChecker() {
|
||||||
|
const [state, setState] = useState<State>({ kind: 'idle' });
|
||||||
|
const [expanded, setExpanded] = useState(false);
|
||||||
|
const unlisten = useRef<(() => void) | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
unlisten.current?.();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
async function handleCheck() {
|
||||||
|
setState({ kind: 'checking' });
|
||||||
|
setExpanded(false);
|
||||||
|
try {
|
||||||
|
const info = await invoke<UpdateInfo>('check_for_update');
|
||||||
|
if (info.available) {
|
||||||
|
setState({ kind: 'available', info });
|
||||||
|
setExpanded(true);
|
||||||
|
} else {
|
||||||
|
setState({ kind: 'up_to_date' });
|
||||||
|
// Auto-clear after 4 s
|
||||||
|
setTimeout(() => setState({ kind: 'idle' }), 4000);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
setState({ kind: 'error', message: String(e) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleInstall(info: UpdateInfo) {
|
||||||
|
setState({ kind: 'downloading', downloaded: 0, total: info.asset_size });
|
||||||
|
|
||||||
|
// Listen for streaming progress events from Rust
|
||||||
|
unlisten.current?.();
|
||||||
|
unlisten.current = await listen<ProgressEvent>('update-progress', (ev) => {
|
||||||
|
setState({ kind: 'downloading', downloaded: ev.payload.downloaded, total: ev.payload.total });
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
await invoke('download_and_install_update', {
|
||||||
|
downloadUrl: info.download_url,
|
||||||
|
assetName: info.asset_name,
|
||||||
|
});
|
||||||
|
unlisten.current?.();
|
||||||
|
setState({ kind: 'launching' });
|
||||||
|
} catch (e) {
|
||||||
|
unlisten.current?.();
|
||||||
|
setState({ kind: 'error', message: String(e) });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ── Render ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
if (state.kind === 'idle') {
|
||||||
|
return (
|
||||||
|
<button className={styles.checkBtn} onClick={handleCheck} title="Check for updates">
|
||||||
|
[Update]
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.kind === 'checking') {
|
||||||
|
return <span className={styles.status}>Checking…</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.kind === 'up_to_date') {
|
||||||
|
return <span className={`${styles.status} ${styles.ok}`}>✓ Up to date</span>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.kind === 'error') {
|
||||||
|
return (
|
||||||
|
<span
|
||||||
|
className={`${styles.status} ${styles.err}`}
|
||||||
|
title={state.message}
|
||||||
|
onClick={() => setState({ kind: 'idle' })}
|
||||||
|
>
|
||||||
|
✗ Update error — click to dismiss
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.kind === 'launching') {
|
||||||
|
return (
|
||||||
|
<span className={`${styles.status} ${styles.ok}`}>
|
||||||
|
✓ Installer launched — complete the wizard to finish
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.kind === 'downloading') {
|
||||||
|
const pct = state.total > 0 ? Math.round((state.downloaded / state.total) * 100) : 0;
|
||||||
|
return (
|
||||||
|
<div className={styles.downloadRow}>
|
||||||
|
<span className={styles.downloadLabel}>
|
||||||
|
Downloading… {fmtBytes(state.downloaded)}
|
||||||
|
{state.total > 0 ? ` / ${fmtBytes(state.total)}` : ''}
|
||||||
|
</span>
|
||||||
|
<div className={styles.progressBar}>
|
||||||
|
<div className={styles.progressFill} style={{ width: `${pct}%` }} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// state.kind === 'available'
|
||||||
|
const { info } = state;
|
||||||
|
return (
|
||||||
|
<div className={styles.banner}>
|
||||||
|
<div className={styles.bannerRow}>
|
||||||
|
<span className={styles.bannerTitle}>
|
||||||
|
✦ v{info.latest_version} available
|
||||||
|
</span>
|
||||||
|
<button className={styles.installBtn} onClick={() => handleInstall(info)}>
|
||||||
|
Install Update
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={styles.toggleBtn}
|
||||||
|
onClick={() => setExpanded((e) => !e)}
|
||||||
|
title={expanded ? 'Hide notes' : 'Show notes'}
|
||||||
|
>
|
||||||
|
{expanded ? '▴' : '▾'}
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className={styles.dismissBtn}
|
||||||
|
onClick={() => setState({ kind: 'idle' })}
|
||||||
|
title="Dismiss"
|
||||||
|
>
|
||||||
|
✕
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{expanded && info.release_notes && (
|
||||||
|
<div className={styles.notes}>
|
||||||
|
<pre className={styles.notesText}>{info.release_notes}</pre>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -14,8 +14,11 @@
|
|||||||
--accent-green: #3a6b3a;
|
--accent-green: #3a6b3a;
|
||||||
--scrollbar-thumb: #3a3020;
|
--scrollbar-thumb: #3a3020;
|
||||||
|
|
||||||
font-family: 'EB Garamond', Georgia, serif;
|
--font-family-body: 'EB Garamond', Georgia, serif;
|
||||||
font-size: 16px;
|
--font-size-base: 16px;
|
||||||
|
|
||||||
|
font-family: var(--font-family-body);
|
||||||
|
font-size: var(--font-size-base);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
background-color: var(--bg-base);
|
background-color: var(--bg-base);
|
||||||
}
|
}
|
||||||
@@ -67,11 +70,13 @@ body {
|
|||||||
button {
|
button {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Input */
|
/* Input */
|
||||||
input, textarea, select {
|
input, textarea, select {
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
background: var(--bg-elevated);
|
background: var(--bg-elevated);
|
||||||
color: var(--text-primary);
|
color: var(--text-primary);
|
||||||
border: 1px solid var(--border);
|
border: 1px solid var(--border);
|
||||||
|
|||||||
@@ -3,6 +3,80 @@ import type { TileInfo } from '../types/assets';
|
|||||||
import type { ClassSummary, MethodSummary, FlowNode } from '../types/scripts';
|
import type { ClassSummary, MethodSummary, FlowNode } from '../types/scripts';
|
||||||
import type { GumpDrawList } from '../types/gump';
|
import type { GumpDrawList } from '../types/gump';
|
||||||
|
|
||||||
|
// ── Typography constants ──────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
// 7 sizes; index 1 = 16px (the current/default size per spec)
|
||||||
|
export const FONT_SIZE_VALUES = [13, 16, 18, 20, 22, 24, 28] as const;
|
||||||
|
|
||||||
|
export interface FontFamilyOption {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FONT_FAMILY_OPTIONS: FontFamilyOption[] = [
|
||||||
|
{ label: 'EB Garamond (Default)', value: "'EB Garamond', Georgia, serif" },
|
||||||
|
{ label: 'Cinzel', value: "'Cinzel', serif" },
|
||||||
|
{ label: 'Georgia', value: 'Georgia, serif' },
|
||||||
|
{ label: 'Palatino', value: "'Palatino Linotype', Palatino, serif" },
|
||||||
|
{ label: 'System UI', value: 'system-ui, sans-serif' },
|
||||||
|
];
|
||||||
|
|
||||||
|
export const DEFAULT_FONT_FAMILY = FONT_FAMILY_OPTIONS[0].value;
|
||||||
|
export const DEFAULT_TEXT_COLOR = '#d4c49a';
|
||||||
|
export const DEFAULT_FONT_SIZE_INDEX_REAL = 1; // index 1 = 16px
|
||||||
|
|
||||||
|
// ── Color utilities ───────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
function hexToRgb(hex: string): [number, number, number] {
|
||||||
|
const n = parseInt(hex.replace('#', ''), 16);
|
||||||
|
return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
|
||||||
|
}
|
||||||
|
|
||||||
|
function rgbToHex(r: number, g: number, b: number): string {
|
||||||
|
return '#' + [r, g, b]
|
||||||
|
.map((v) => Math.max(0, Math.min(255, Math.round(v))).toString(16).padStart(2, '0'))
|
||||||
|
.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Scale each channel by `factor` (0–2). Values above 255 are clamped. */
|
||||||
|
function scaleColor(hex: string, factor: number): string {
|
||||||
|
const [r, g, b] = hexToRgb(hex);
|
||||||
|
return rgbToHex(r * factor, g * factor, b * factor);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Derive the full text-color palette from a single primary color.
|
||||||
|
*
|
||||||
|
* Relationships mirror the default palette ratios:
|
||||||
|
* primary (#d4c49a) → 1.0×
|
||||||
|
* accent-gold-bright → ~1.08× (slightly brighter/warmer)
|
||||||
|
* accent-gold → ~0.88×
|
||||||
|
* text-secondary → ~0.54×
|
||||||
|
* text-muted → ~0.29×
|
||||||
|
*/
|
||||||
|
function deriveColorPalette(primary: string) {
|
||||||
|
return {
|
||||||
|
'--text-primary': primary,
|
||||||
|
'--accent-gold-bright': scaleColor(primary, 1.08),
|
||||||
|
'--accent-gold': scaleColor(primary, 0.88),
|
||||||
|
'--text-secondary': scaleColor(primary, 0.54),
|
||||||
|
'--text-muted': scaleColor(primary, 0.29),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export function applyTypographyVars(fontFamily: string, fontSizeIndex: number, textColor: string) {
|
||||||
|
const size = FONT_SIZE_VALUES[fontSizeIndex] ?? 16;
|
||||||
|
const el = document.documentElement;
|
||||||
|
|
||||||
|
el.style.setProperty('--font-family-body', fontFamily);
|
||||||
|
el.style.setProperty('--font-size-base', `${size}px`);
|
||||||
|
|
||||||
|
const palette = deriveColorPalette(textColor);
|
||||||
|
for (const [prop, val] of Object.entries(palette)) {
|
||||||
|
el.style.setProperty(prop, val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export type LeftPanelTab = 'scripts' | 'statics' | 'mobiles' | 'gumps';
|
export type LeftPanelTab = 'scripts' | 'statics' | 'mobiles' | 'gumps';
|
||||||
|
|
||||||
export type CenterMode =
|
export type CenterMode =
|
||||||
@@ -38,6 +112,14 @@ interface AppState {
|
|||||||
setAssetFormat: (f: 'mul' | 'uop') => void;
|
setAssetFormat: (f: 'mul' | 'uop') => void;
|
||||||
setIsConfigured: (v: boolean) => void;
|
setIsConfigured: (v: boolean) => void;
|
||||||
|
|
||||||
|
// Typography
|
||||||
|
fontFamily: string;
|
||||||
|
fontSizeIndex: number;
|
||||||
|
textColor: string;
|
||||||
|
setFontFamily: (f: string) => void;
|
||||||
|
setFontSizeIndex: (i: number) => void;
|
||||||
|
setTextColor: (c: string) => void;
|
||||||
|
|
||||||
// Navigation
|
// Navigation
|
||||||
activeTab: LeftPanelTab;
|
activeTab: LeftPanelTab;
|
||||||
centerMode: CenterMode;
|
centerMode: CenterMode;
|
||||||
@@ -88,6 +170,28 @@ export const useAppStore = create<AppState>((set) => ({
|
|||||||
setAssetFormat: (f) => set({ assetFormat: f }),
|
setAssetFormat: (f) => set({ assetFormat: f }),
|
||||||
setIsConfigured: (v) => set({ isConfigured: v }),
|
setIsConfigured: (v) => set({ isConfigured: v }),
|
||||||
|
|
||||||
|
fontFamily: DEFAULT_FONT_FAMILY,
|
||||||
|
fontSizeIndex: DEFAULT_FONT_SIZE_INDEX_REAL,
|
||||||
|
textColor: DEFAULT_TEXT_COLOR,
|
||||||
|
setFontFamily: (f) => {
|
||||||
|
set((s) => {
|
||||||
|
applyTypographyVars(f, s.fontSizeIndex, s.textColor);
|
||||||
|
return { fontFamily: f };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setFontSizeIndex: (i) => {
|
||||||
|
set((s) => {
|
||||||
|
applyTypographyVars(s.fontFamily, i, s.textColor);
|
||||||
|
return { fontSizeIndex: i };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
setTextColor: (c) => {
|
||||||
|
set((s) => {
|
||||||
|
applyTypographyVars(s.fontFamily, s.fontSizeIndex, c);
|
||||||
|
return { textColor: c };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
activeTab: 'statics',
|
activeTab: 'statics',
|
||||||
centerMode: 'empty',
|
centerMode: 'empty',
|
||||||
setActiveTab: (tab) => set({ activeTab: tab }),
|
setActiveTab: (tab) => set({ activeTab: tab }),
|
||||||
|
|||||||
Reference in New Issue
Block a user