Test basic building env

This commit is contained in:
chrox
2024-09-26 19:02:06 +02:00
parent 7a2e5d6e52
commit aa07a4de3b
12 changed files with 6642 additions and 197 deletions
+4
View File
@@ -10,6 +10,10 @@
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "2.0.0-rc.5",
"@tauri-apps/plugin-fs": "2.0.0-rc.2",
"@tauri-apps/plugin-log": "2.0.0-rc.1",
"lucide-react": "^0.446.0",
"next": "14.2.13",
"react": "^18",
"react-dom": "^18"
+41 -12
View File
@@ -96,18 +96,6 @@ version = "1.0.89"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
[[package]]
name = "app"
version = "0.1.0"
dependencies = [
"log",
"serde",
"serde_json",
"tauri",
"tauri-build",
"tauri-plugin-log",
]
[[package]]
name = "arrayvec"
version = "0.7.6"
@@ -1461,6 +1449,12 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "http-range"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573"
[[package]]
name = "httparse"
version = "1.9.4"
@@ -2633,6 +2627,19 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
[[package]]
name = "readest"
version = "0.1.0"
dependencies = [
"log",
"serde",
"serde_json",
"tauri",
"tauri-build",
"tauri-plugin-fs",
"tauri-plugin-log",
]
[[package]]
name = "redox_syscall"
version = "0.5.4"
@@ -3355,6 +3362,7 @@ dependencies = [
"gtk",
"heck 0.5.0",
"http",
"http-range",
"jni",
"libc",
"log",
@@ -3469,6 +3477,27 @@ dependencies = [
"walkdir",
]
[[package]]
name = "tauri-plugin-fs"
version = "2.0.0-rc.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cb1dfbbea322afbc9dec49351bc29edf4e85e74d37d9a3fcc72d67ed55ffdbd"
dependencies = [
"anyhow",
"dunce",
"glob",
"percent-encoding",
"schemars",
"serde",
"serde_json",
"serde_repr",
"tauri",
"tauri-plugin",
"thiserror",
"url",
"uuid",
]
[[package]]
name = "tauri-plugin-log"
version = "2.0.0-rc.2"
+4 -3
View File
@@ -1,5 +1,5 @@
[package]
name = "app"
name = "readest"
version = "0.1.0"
description = "A Tauri App"
authors = ["you"]
@@ -11,7 +11,7 @@ rust-version = "1.71"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "app_lib"
name = "readest"
crate-type = ["staticlib", "cdylib", "lib"]
[build-dependencies]
@@ -21,5 +21,6 @@ tauri-build = { version = "2.0.0-rc.12", features = [] }
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
log = "0.4"
tauri = { version = "2.0.0-rc.15", features = [] }
tauri = { version = "2.0.0-rc.15", features = ["protocol-asset"] }
tauri-plugin-log = "2.0.0-rc"
tauri-plugin-fs = "2.0.0-rc"
@@ -6,6 +6,16 @@
"main"
],
"permissions": [
"core:default"
"core:default",
"fs:default",
{
"identifier": "fs:scope-document-recursive",
"allow": [
{
"path": "$DOCUMENT/**/*"
}
],
"deny": []
}
]
}
}
+1
View File
@@ -1,6 +1,7 @@
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_fs::init())
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
+1 -1
View File
@@ -2,5 +2,5 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
app_lib::run();
readest::run();
}
+16 -2
View File
@@ -10,6 +10,7 @@
"beforeBuildCommand": "pnpm build"
},
"app": {
"withGlobalTauri": true,
"windows": [
{
"title": "Readest",
@@ -20,7 +21,14 @@
}
],
"security": {
"csp": null
"csp": "default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost",
"assetProtocol": {
"enable": true,
"scope": {
"allow": ["$RESOURCE/**", "$DOCUMENT/**/*"],
"deny": []
}
}
}
},
"bundle": {
@@ -32,6 +40,12 @@
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
],
"resources": []
},
"plugins": {
"fs": {
"requireLiteralLeadingDot": false
}
}
}
+12 -12
View File
@@ -1,21 +1,21 @@
import type { Metadata } from "next";
import localFont from "next/font/local";
import "./globals.css";
import type { Metadata } from 'next';
import localFont from 'next/font/local';
import './globals.css';
const geistSans = localFont({
src: "./fonts/GeistVF.woff",
variable: "--font-geist-sans",
weight: "100 900",
src: './fonts/GeistVF.woff',
variable: '--font-geist-sans',
weight: '100 900',
});
const geistMono = localFont({
src: "./fonts/GeistMonoVF.woff",
variable: "--font-geist-mono",
weight: "100 900",
src: './fonts/GeistMonoVF.woff',
variable: '--font-geist-mono',
weight: '100 900',
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: 'Readest',
description: 'read to learn',
};
export default function RootLayout({
@@ -24,7 +24,7 @@ export default function RootLayout({
children: React.ReactNode;
}>) {
return (
<html lang="en">
<html lang='en'>
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
@@ -0,0 +1,48 @@
.libraryContainer {
padding: 16px;
}
.viewToggle {
display: flex;
justify-content: flex-end;
margin-bottom: 16px;
}
.viewToggle button {
background: none;
border: none;
padding: 8px;
cursor: pointer;
color: #333;
}
.viewToggle button.active {
color: blue;
}
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 16px;
}
.list {
display: block;
}
.bookCard {
text-align: center;
border: 1px solid #eaeaea;
padding: 16px;
border-radius: 8px;
}
.bookCard img {
width: 100%;
height: auto;
border-radius: 8px;
}
.bookCard h3 {
margin-top: 12px;
}
+43 -92
View File
@@ -1,101 +1,52 @@
import Image from "next/image";
'use client';
import * as React from 'react';
import { useState } from 'react';
import Image from 'next/image';
import { LayoutGrid, LayoutList } from 'lucide-react';
import styles from './library.module.css';
const BOOKS_DIR = '/Users/chrox/Documents/DigestLibrary/books';
const books = [
{ title: 'Book 1', thumbnail: `asset://localhost/${BOOKS_DIR}/book1.png` },
{ title: 'Book 2', thumbnail: `asset://localhost/${BOOKS_DIR}/book2.png` },
{ title: 'Book 3', thumbnail: `asset://localhost/${BOOKS_DIR}/book3.png` },
];
export default function LibraryPage() {
const [view, setView] = useState<'grid' | 'list'>('grid');
export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<main className="flex flex-col gap-8 row-start-2 items-center sm:items-start">
<Image
className="dark:invert"
src="https://nextjs.org/icons/next.svg"
alt="Next.js logo"
width={180}
height={38}
priority
/>
<ol className="list-inside list-decimal text-sm text-center sm:text-left font-[family-name:var(--font-geist-mono)]">
<li className="mb-2">
Get started by editing{" "}
<code className="bg-black/[.05] dark:bg-white/[.06] px-1 py-0.5 rounded font-semibold">
src/app/page.tsx
</code>
.
</li>
<li>Save and see your changes instantly.</li>
</ol>
<div className={styles['libraryContainer']}>
<div className={styles['viewToggle']}>
<button
onClick={() => setView('grid')}
className={view === 'grid' ? styles['active'] : ''}
>
<LayoutGrid />
</button>
<button
onClick={() => setView('list')}
className={view === 'list' ? styles['active'] : ''}
>
<LayoutList />
</button>
</div>
<div className="flex gap-4 items-center flex-col sm:flex-row">
<a
className="rounded-full border border-solid border-transparent transition-colors flex items-center justify-center bg-foreground text-background gap-2 hover:bg-[#383838] dark:hover:bg-[#ccc] text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5"
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<div className={view === 'grid' ? styles['grid'] : styles['list']}>
{books.map((book, index) => (
<div key={index} className={styles['bookCard']}>
<Image
className="dark:invert"
src="https://nextjs.org/icons/vercel.svg"
alt="Vercel logomark"
src={book.thumbnail}
alt={book.title}
width={20}
height={20}
height={30}
/>
Deploy now
</a>
<a
className="rounded-full border border-solid border-black/[.08] dark:border-white/[.145] transition-colors flex items-center justify-center hover:bg-[#f2f2f2] dark:hover:bg-[#1a1a1a] hover:border-transparent text-sm sm:text-base h-10 sm:h-12 px-4 sm:px-5 sm:min-w-44"
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
Read our docs
</a>
</div>
</main>
<footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center">
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/file.svg"
alt="File icon"
width={16}
height={16}
/>
Learn
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/window.svg"
alt="Window icon"
width={16}
height={16}
/>
Examples
</a>
<a
className="flex items-center gap-2 hover:underline hover:underline-offset-4"
href="https://nextjs.org?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
target="_blank"
rel="noopener noreferrer"
>
<Image
aria-hidden
src="https://nextjs.org/icons/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
Go to nextjs.org
</a>
</footer>
<h3>{book.title}</h3>
</div>
))}
</div>
</div>
);
}
+3 -1
View File
@@ -3,14 +3,16 @@
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"tauri": "pnpm --filter @digest/digest-app tauri"
"tauri": "pnpm --filter @readest/readest-app tauri"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^6.0.0",
"cross-env": "^7.0.3",
"eslint": "^8",
"eslint-config-prettier": "^9.1.0",
"husky": "^9.1.6",
"prettier": "^3.3.3",
"prettier-plugin-tailwindcss": "^0.6.8",
"typescript": "^5"
}
}
+6457 -72
View File
File diff suppressed because it is too large Load Diff