diff --git a/.gitignore b/.gitignore index 100d207..6aac21d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. -# dependencies -/node_modules /.pnp .pnp.js .yarn/install-state.gz @@ -16,19 +14,8 @@ # production /build -# misc -.DS_Store *.pem -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env -.env*.local - # vercel .vercel @@ -38,3 +25,30 @@ next-env.d.ts **/__pycache__/ /target + + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +.env +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..24d7cc6 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,3 @@ +{ + "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] +} diff --git a/README.md b/README.md index 04cd46f..36bc456 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,16 @@ an AGI operating system > [!IMPORTANT] > This project is currently in a very early development/experimental stage. There are a lot of unimplemented/broken features at the moment. Contributions are welcome to help out with the progress! + +## Installation + +- `git clone https://github.com/cs50victor/os1.git` +- `cd os1` +- `cargo tauri dev` + +## Milestone + +- [ ] Be fully compatible with M1 / M2 / M3 macbooks. + + + diff --git a/app/auth/callback/route.ts b/app/auth/callback/route.ts deleted file mode 100644 index 58e15fe..0000000 --- a/app/auth/callback/route.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { createClient } from "~/utils/supabase/server"; -import { NextResponse } from "next/server"; - -export async function GET(request: Request) { - // The `/auth/callback` route is required for the server-side auth flow implemented - // by the SSR package. It exchanges an auth code for the user's session. - // https://supabase.com/docs/guides/auth/server-side/nextjs - const requestUrl = new URL(request.url); - const code = requestUrl.searchParams.get("code"); - const origin = requestUrl.origin; - - if (code) { - const supabase = createClient(); - await supabase.auth.exchangeCodeForSession(code); - } - - // URL to redirect to after sign up process completes - return NextResponse.redirect(`${origin}/protected`); -} diff --git a/app/favicon.ico b/app/favicon.ico deleted file mode 100644 index 718d6fe..0000000 Binary files a/app/favicon.ico and /dev/null differ diff --git a/app/globals.css b/app/globals.css deleted file mode 100644 index 50bd9fc..0000000 --- a/app/globals.css +++ /dev/null @@ -1,42 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@layer base { - :root { - --background: 200 20% 98%; - --btn-background: 200 10% 91%; - --btn-background-hover: 200 10% 89%; - --foreground: 200 50% 3%; - } - - @media (prefers-color-scheme: dark) { - :root { - --background: 200 50% 3%; - --btn-background: 200 10% 9%; - --btn-background-hover: 200 10% 12%; - --foreground: 200 20% 96%; - } - } -} - -@layer base { - * { - @apply border-foreground/20; - } -} - -.animate-in { - animation: animateIn 0.3s ease 0.15s both; -} - -@keyframes animateIn { - from { - opacity: 0; - transform: translateY(10px); - } - to { - opacity: 1; - transform: translateY(0); - } -} diff --git a/app/layout.tsx b/app/layout.tsx deleted file mode 100644 index 39e5666..0000000 --- a/app/layout.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { GeistSans } from "geist/font/sans"; -import "./globals.css"; - -const defaultUrl = process.env.VERCEL_URL - ? `https://${process.env.VERCEL_URL}` - : "http://localhost:3000"; - -export const metadata = { - metadataBase: new URL(defaultUrl), - title: "Next.js and Supabase Starter Kit", - description: "The fastest way to build apps with Next.js and Supabase", -}; - -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}) { - return ( - - -
- {children} -
- - - ); -} diff --git a/app/login/page.tsx b/app/login/page.tsx deleted file mode 100644 index f6ed47a..0000000 --- a/app/login/page.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import Link from "next/link"; -import { headers } from "next/headers"; -import { createClient } from "~/utils/supabase/server"; -import { redirect } from "next/navigation"; -import { SubmitButton } from "./submit-button"; - -export default function Login({ - searchParams, -}: { - searchParams: { message: string }; -}) { - const signIn = async (formData: FormData) => { - "use server"; - - const email = formData.get("email") as string; - const password = formData.get("password") as string; - const supabase = createClient(); - - const { error } = await supabase.auth.signInWithPassword({ - email, - password, - }); - - if (error) { - return redirect("/login?message=Could not authenticate user"); - } - - return redirect("/protected"); - }; - - const signUp = async (formData: FormData) => { - "use server"; - - const origin = headers().get("origin"); - const email = formData.get("email") as string; - const password = formData.get("password") as string; - const supabase = createClient(); - - const { error } = await supabase.auth.signUp({ - email, - password, - options: { - emailRedirectTo: `${origin}/auth/callback`, - }, - }); - - if (error) { - return redirect("/login?message=Could not authenticate user"); - } - - return redirect("/login?message=Check email to continue sign in process"); - }; - - return ( -
- - - - {" "} - Back - - -
- - - - - - Sign In - - - Sign Up - - {searchParams?.message && ( -

- {searchParams.message} -

- )} -
-
- ); -} diff --git a/app/login/submit-button.tsx b/app/login/submit-button.tsx deleted file mode 100644 index 9d85533..0000000 --- a/app/login/submit-button.tsx +++ /dev/null @@ -1,20 +0,0 @@ -"use client"; - -import { useFormStatus } from "react-dom"; -import { type ComponentProps } from "react"; - -type Props = ComponentProps<"button"> & { - pendingText?: string; -}; - -export function SubmitButton({ children, pendingText, ...props }: Props) { - const { pending, action } = useFormStatus(); - - const isPending = pending && action === props.formAction; - - return ( - - ); -} diff --git a/app/opengraph-image.png b/app/opengraph-image.png deleted file mode 100644 index 57595e6..0000000 Binary files a/app/opengraph-image.png and /dev/null differ diff --git a/app/page.tsx b/app/page.tsx deleted file mode 100644 index c61a010..0000000 --- a/app/page.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import DeployButton from "../components/DeployButton"; -import AuthButton from "../components/AuthButton"; -import { createClient } from "~/utils/supabase/server"; -import ConnectSupabaseSteps from "~/components/tutorial/ConnectSupabaseSteps"; -import SignUpUserSteps from "~/components/tutorial/SignUpUserSteps"; -import Header from "~/components/Header"; - -export default async function Index() { - const canInitSupabaseClient = () => { - // This function is just for the interactive tutorial. - // Feel free to remove it once you have Supabase connected. - try { - createClient(); - return true; - } catch (e) { - return false; - } - }; - - const isSupabaseConnected = canInitSupabaseClient(); - - return ( -
- - -
-
-
-

Next steps

- {isSupabaseConnected ? : } -
-
- - -
- ); -} diff --git a/app/protected/page.tsx b/app/protected/page.tsx deleted file mode 100644 index 7476b47..0000000 --- a/app/protected/page.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import DeployButton from "~/components/DeployButton"; -import AuthButton from "~/components/AuthButton"; -import { createClient } from "~/utils/supabase/server"; -import FetchDataSteps from "~/components/tutorial/FetchDataSteps"; -import Header from "~/components/Header"; -import { redirect } from "next/navigation"; - -export default async function ProtectedPage() { - const supabase = createClient(); - - const { - data: { user }, - } = await supabase.auth.getUser(); - - if (!user) { - return redirect("/login"); - } - - return ( -
-
-
- This is a protected page that you can only see as an authenticated - user -
- -
- -
-
-
-

Next steps

- -
-
- - -
- ); -} diff --git a/app/twitter-image.png b/app/twitter-image.png deleted file mode 100644 index 57595e6..0000000 Binary files a/app/twitter-image.png and /dev/null differ diff --git a/bun.lockb b/bun.lockb index e7c0961..56ed936 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components.json b/components.json new file mode 100644 index 0000000..6e5ccdc --- /dev/null +++ b/components.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://ui.shadcn.com/schema.json", + "style": "default", + "rsc": false, + "tsx": true, + "tailwind": { + "config": "tailwind.config.ts", + "css": "src/globals.css", + "baseColor": "neutral", + "cssVariables": true, + "prefix": "" + }, + "aliases": { + "components": "~/components", + "utils": "~/utils/tw" + } +} \ No newline at end of file diff --git a/components/AuthButton.tsx b/components/AuthButton.tsx deleted file mode 100644 index 3f6f944..0000000 --- a/components/AuthButton.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { createClient } from "~/utils/supabase/server"; -import Link from "next/link"; -import { redirect } from "next/navigation"; - -export default async function AuthButton() { - const supabase = createClient(); - - const { - data: { user }, - } = await supabase.auth.getUser(); - - const signOut = async () => { - "use server"; - - const supabase = createClient(); - await supabase.auth.signOut(); - return redirect("/login"); - }; - - return user ? ( -
- Hey, {user.email}! -
- -
-
- ) : ( - - Login - - ); -} diff --git a/components/DeployButton.tsx b/components/DeployButton.tsx deleted file mode 100644 index c46d23f..0000000 --- a/components/DeployButton.tsx +++ /dev/null @@ -1,23 +0,0 @@ -export default function DeployButton() { - return ( - - - - - Deploy to Vercel - - ); -} diff --git a/components/Header.tsx b/components/Header.tsx deleted file mode 100644 index 9996d5d..0000000 --- a/components/Header.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import NextLogo from "./NextLogo"; -import SupabaseLogo from "./SupabaseLogo"; - -export default function Header() { - return ( -
-
- - - - - - - -
-

Supabase and Next.js Starter Template

-

- The fastest way to build apps with{" "} - - Supabase - {" "} - and{" "} - - Next.js - -

-
-
- ); -} diff --git a/components/NextLogo.tsx b/components/NextLogo.tsx deleted file mode 100644 index 1655582..0000000 --- a/components/NextLogo.tsx +++ /dev/null @@ -1,46 +0,0 @@ -export default function NextLogo() { - return ( - - - - - - - - - - - ); -} diff --git a/components/SupabaseLogo.tsx b/components/SupabaseLogo.tsx deleted file mode 100644 index 96a56a5..0000000 --- a/components/SupabaseLogo.tsx +++ /dev/null @@ -1,102 +0,0 @@ -export default function SupabaseLogo() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/components/tutorial/Code.tsx b/components/tutorial/Code.tsx deleted file mode 100644 index f96d0cf..0000000 --- a/components/tutorial/Code.tsx +++ /dev/null @@ -1,58 +0,0 @@ -"use client"; - -import { useState } from "react"; - -const CopyIcon = () => ( - - - - -); - -const CheckIcon = () => ( - - - -); - -export default function Code({ code }: { code: string }) { - const [icon, setIcon] = useState(CopyIcon); - - const copy = async () => { - await navigator?.clipboard?.writeText(code); - setIcon(CheckIcon); - setTimeout(() => setIcon(CopyIcon), 2000); - }; - - return ( -
-      
-      {code}
-    
- ); -} diff --git a/components/tutorial/ConnectSupabaseSteps.tsx b/components/tutorial/ConnectSupabaseSteps.tsx deleted file mode 100644 index 0493b8d..0000000 --- a/components/tutorial/ConnectSupabaseSteps.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import Step from "./Step"; - -export default function ConnectSupabaseSteps() { - return ( -
    - -

    - Head over to{" "} - - database.new - {" "} - and create a new Supabase project. -

    -
    - - -

    - Rename the{" "} - - .env.example - {" "} - file in your Next.js app to{" "} - - .env.local - {" "} - and populate with values from{" "} - - your Supabase project's API Settings - - . -

    -
    - - -

    - You may need to quit your Next.js development server and run{" "} - - npm run dev - {" "} - again to load the new environment variables. -

    -
    - - -

    - You may need to refresh the page for Next.js to load the new - environment variables. -

    -
    -
- ); -} diff --git a/components/tutorial/FetchDataSteps.tsx b/components/tutorial/FetchDataSteps.tsx deleted file mode 100644 index 463dbfe..0000000 --- a/components/tutorial/FetchDataSteps.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import Step from "./Step"; -import Code from "./Code"; - -const create = ` -create table notes ( - id bigserial primary key, - title text -); - -insert into notes(title) -values - ('Today I created a Supabase project.'), - ('I added some data and queried it from Next.js.'), - ('It was awesome!'); -`.trim(); - -const server = ` -import { createClient } from '~/utils/supabase/server' - -export default async function Page() { - const supabase = createClient() - const { data: notes } = await supabase.from('notes').select() - - return
{JSON.stringify(notes, null, 2)}
-} -`.trim(); - -const client = ` -'use client' - -import { createClient } from '~/utils/supabase/client' -import { useEffect, useState } from 'react' - -export default function Page() { - const [notes, setNotes] = useState(null) - const supabase = createClient() - - useEffect(() => { - const getData = async () => { - const { data } = await supabase.from('notes').select() - setNotes(data) - } - getData() - }, []) - - return
{JSON.stringify(notes, null, 2)}
-} -`.trim(); - -export default function FetchDataSteps() { - return ( -
    - -

    - Head over to the{" "} - - Table Editor - {" "} - for your Supabase project to create a table and insert some example - data. If you're stuck for creativity, you can copy and paste the - following into the{" "} - - SQL Editor - {" "} - and click RUN! -

    - -
    - - -

    - To create a Supabase client and query data from an Async Server - Component, create a new page.tsx file at{" "} - - /app/notes/page.tsx - {" "} - and add the following. -

    - -

    Alternatively, you can use a Client Component.

    - -
    - - -

    You're ready to launch your product to the world! 🚀

    -
    -
- ); -} diff --git a/components/tutorial/SignUpUserSteps.tsx b/components/tutorial/SignUpUserSteps.tsx deleted file mode 100644 index 6af78a0..0000000 --- a/components/tutorial/SignUpUserSteps.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import Link from "next/link"; -import Step from "./Step"; - -export default function SignUpUserSteps() { - return ( -
    - -

    - Head over to the{" "} - - Login - {" "} - page and sign up your first user. It's okay if this is just you for - now. Your awesome idea will have plenty of users later! -

    -
    -
- ); -} diff --git a/components/tutorial/Step.tsx b/components/tutorial/Step.tsx deleted file mode 100644 index cad86cf..0000000 --- a/components/tutorial/Step.tsx +++ /dev/null @@ -1,24 +0,0 @@ -export default function Step({ - title, - children, -}: { - title: string; - children: React.ReactNode; -}) { - return ( -
  • - - -
    - {children} -
    -
  • - ); -} diff --git a/index.html b/index.html new file mode 100644 index 0000000..03abf55 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + Tauri + React + TS + + + +
    + + + diff --git a/next.config.js b/next.config.js deleted file mode 100644 index d78b168..0000000 --- a/next.config.js +++ /dev/null @@ -1,4 +0,0 @@ -/** @type {import('next').NextConfig} */ -const nextConfig = {output: 'export'}; - -module.exports = nextConfig; diff --git a/package.json b/package.json index 1f75e11..59c9ed7 100644 --- a/package.json +++ b/package.json @@ -1,28 +1,39 @@ { + "name": "os1", "private": true, + "version": "0.0.0", + "type": "module", "scripts": { - "dev": "next dev", - "build": "next build", - "start": "next start" + "dev": "vite", + "build": "tsc && vite build", + "preview": "vite preview", + "tauri": "tauri" }, "dependencies": { - "@supabase/ssr": "latest", - "@supabase/supabase-js": "latest", + "@radix-ui/react-icons": "^1.3.0", + "@radix-ui/react-slot": "^1.0.2", "@tauri-apps/api": "^1.5.3", - "autoprefixer": "10.4.17", - "geist": "^1.2.1", - "next": "latest", - "postcss": "8.4.33", - "react": "18.2.0", - "react-dom": "18.2.0", - "tailwindcss": "3.4.1", - "typescript": "5.3.3" + "class-variance-authority": "^0.7.0", + "clsx": "^2.1.0", + "lucide-react": "^0.363.0", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "tailwind-merge": "^2.2.2" }, "devDependencies": { - "@tauri-apps/cli": "^1.5.11", - "@types/node": "20.11.5", - "@types/react": "18.2.48", - "@types/react-dom": "18.2.18", - "encoding": "^0.1.13" + "@headlessui/tailwindcss": "^0.2.0", + "@tailwindcss/aspect-ratio": "^0.4.2", + "@tailwindcss/forms": "^0.5.7", + "@tailwindcss/typography": "^0.5.10", + "@tauri-apps/cli": "^1", + "@types/react": "^18.2.15", + "@types/react-dom": "^18.2.7", + "@vitejs/plugin-react": "^4.2.1", + "autoprefixer": "^10.4.19", + "postcss": "^8.4.38", + "tailwindcss": "^3.4.1", + "tailwindcss-animate": "^1.0.7", + "typescript": "^5.0.2", + "vite": "^5.0.0" } } diff --git a/postcss.config.js b/postcss.config.cjs similarity index 100% rename from postcss.config.js rename to postcss.config.cjs diff --git a/public/tauri.svg b/public/tauri.svg new file mode 100644 index 0000000..31b62c9 --- /dev/null +++ b/public/tauri.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/public/vite.svg b/public/vite.svg new file mode 100644 index 0000000..e7b8dfb --- /dev/null +++ b/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src-tauri/.gitignore b/src-tauri/.gitignore index aba21e2..f4dfb82 100644 --- a/src-tauri/.gitignore +++ b/src-tauri/.gitignore @@ -1,3 +1,4 @@ # Generated by Cargo # will have compiled files and executables /target/ + diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 2d29d38..b24ea6e 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -62,18 +62,6 @@ version = "1.0.81" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" -[[package]] -name = "app" -version = "0.1.0" -dependencies = [ - "dotenvy", - "pretty_env_logger", - "serde", - "serde_json", - "tauri", - "tauri-build", -] - [[package]] name = "atk" version = "0.15.1" @@ -106,9 +94,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.70" +version = "0.3.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95d8e92cac0961e91dbd517496b00f7e9b92363dbe6d42c3198268323798860c" +checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" dependencies = [ "addr2line", "cc", @@ -209,9 +197,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "cairo-rs" @@ -594,12 +582,6 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - [[package]] name = "dtoa" version = "1.0.9" @@ -650,19 +632,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "env_logger" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580" -dependencies = [ - "humantime", - "is-terminal", - "log", - "regex", - "termcolor", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -1211,12 +1180,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" -[[package]] -name = "humantime" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" - [[package]] name = "iana-time-zone" version = "0.1.60" @@ -1307,9 +1270,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.5" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1334,17 +1297,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "is-terminal" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.52.0", -] - [[package]] name = "itoa" version = "0.4.8" @@ -1440,12 +1392,46 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "libappindicator" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2d3cb96d092b4824cb306c9e544c856a4cb6210c1081945187f7f1924b47e8" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1b3b6681973cea8cc3bce7391e6d7d5502720b80a581c9a95c9cbaf592826aa" +dependencies = [ + "gtk-sys", + "libloading", + "once_cell", +] + [[package]] name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + [[package]] name = "libredox" version = "0.0.1" @@ -1459,12 +1445,9 @@ dependencies = [ [[package]] name = "line-wrap" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9" -dependencies = [ - "safemem", -] +checksum = "dd1bc4d24ad230d21fb898d1116b1801d7adfc449d42026475862ab48b11e70e" [[package]] name = "linux-raw-sys" @@ -1711,6 +1694,26 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "open" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2078c0039e6a54a0c42c28faa984e115fb4c2d5bf2208f77d1961002df8576f8" +dependencies = [ + "pathdiff", + "windows-sys 0.42.0", +] + +[[package]] +name = "os1" +version = "0.0.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build", +] + [[package]] name = "overload" version = "0.1.1" @@ -1765,6 +1768,12 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "percent-encoding" version = "2.3.1" @@ -1925,12 +1934,12 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plist" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" +checksum = "d9d34169e64b3c7a80c8621a48adaf44e0cf62c78a9b25dd9dd35f1881a17cf9" dependencies = [ "base64 0.21.7", - "indexmap 2.2.5", + "indexmap 2.2.6", "line-wrap", "quick-xml", "serde", @@ -1968,16 +1977,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" -[[package]] -name = "pretty_env_logger" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "865724d4dbe39d9f3dd3b52b88d859d66bcb2d6a0acfd5ea68a65fb66d4bdc1c" -dependencies = [ - "env_logger", - "log", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -2154,9 +2153,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" dependencies = [ "aho-corasick", "memchr", @@ -2236,12 +2235,6 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" -[[package]] -name = "safemem" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" - [[package]] name = "same-file" version = "1.0.6" @@ -2318,7 +2311,7 @@ version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "itoa 1.0.10", "ryu", "serde", @@ -2354,7 +2347,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_derive", "serde_json", @@ -2589,6 +2582,7 @@ dependencies = [ "core-foundation", "core-graphics", "crossbeam-channel", + "dirs-next", "dispatch", "gdk", "gdk-pixbuf", @@ -2603,6 +2597,7 @@ dependencies = [ "instant", "jni", "lazy_static", + "libappindicator", "libc", "log", "ndk", @@ -2673,9 +2668,11 @@ dependencies = [ "ignore", "objc", "once_cell", + "open", "percent-encoding", "rand 0.8.5", "raw-window-handle", + "regex", "semver", "serde", "serde_json", @@ -2730,6 +2727,7 @@ dependencies = [ "png", "proc-macro2", "quote", + "regex", "semver", "serde", "serde_json", @@ -2859,15 +2857,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "termcolor" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" -dependencies = [ - "winapi-util", -] - [[package]] name = "thin-slice" version = "0.1.1" @@ -3010,7 +2999,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -3023,7 +3012,7 @@ version = "0.22.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4" dependencies = [ - "indexmap 2.2.5", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -3454,6 +3443,21 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ee5e275231f07c6e240d14f34e1b635bf1faa1c76c57cfd59a5cdb9848e4278" +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -3517,6 +3521,12 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -3535,6 +3545,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec7711666096bd4096ffa835238905bb33fb87267910e154b18b44eaabb340f2" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -3553,6 +3569,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "763fc57100a5f7042e3057e7e8d9bdd7860d330070251a73d003563a3bb49e1b" +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -3571,6 +3593,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7bc7cbfe58828921e10a9f446fcaaf649204dcfe6c1ddd712c5eebae6bda1106" +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -3589,6 +3617,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6868c165637d653ae1e8dc4d82c25d4f97dd6605eaa8d784b5c6e0ab2a252b65" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -3601,6 +3635,12 @@ version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -3619,6 +3659,12 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e4d40883ae9cae962787ca76ba76390ffa29214667a111db9e0a1ad8377e809" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index fc0df26..ff00667 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,28 +1,20 @@ [package] -name = "app" -version = "0.1.0" +name = "os1" +version = "0.0.0" description = "A Tauri App" authors = ["you"] -license = "" -repository = "" -default-run = "app" edition = "2021" -rust-version = "1.60" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [build-dependencies] -tauri-build = { version = "1.5.1", features = [] } +tauri-build = { version = "1", features = [] } [dependencies] -serde_json = "1.0" -serde = { version = "1.0", features = ["derive"] } -tauri = { version = "1.6.1", features = [] } -pretty_env_logger = "0.5.0" -dotenvy = "0.15.7" +tauri = { version = "1", features = [ "system-tray", "shell-open"] } +serde = { version = "1", features = ["derive"] } +serde_json = "1" [features] -# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled. -# If you use cargo directly instead of tauri's cli you can use this feature flag to switch between tauri's `dev` and `build` modes. -# DO NOT REMOVE!! -custom-protocol = [ "tauri/custom-protocol" ] +# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! +custom-protocol = ["tauri/custom-protocol"] diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 795b9b7..d860e1e 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -1,3 +1,3 @@ fn main() { - tauri_build::build() + tauri_build::build() } diff --git a/src-tauri/icons/128x128.png b/src-tauri/icons/128x128.png index 77e7d23..6be5e50 100644 Binary files a/src-tauri/icons/128x128.png and b/src-tauri/icons/128x128.png differ diff --git a/src-tauri/icons/128x128@2x.png b/src-tauri/icons/128x128@2x.png index 0f7976f..e81bece 100644 Binary files a/src-tauri/icons/128x128@2x.png and b/src-tauri/icons/128x128@2x.png differ diff --git a/src-tauri/icons/32x32.png b/src-tauri/icons/32x32.png index 98fda06..a437dd5 100644 Binary files a/src-tauri/icons/32x32.png and b/src-tauri/icons/32x32.png differ diff --git a/src-tauri/icons/Square107x107Logo.png b/src-tauri/icons/Square107x107Logo.png index f35d84f..0ca4f27 100644 Binary files a/src-tauri/icons/Square107x107Logo.png and b/src-tauri/icons/Square107x107Logo.png differ diff --git a/src-tauri/icons/Square142x142Logo.png b/src-tauri/icons/Square142x142Logo.png index 1823bb2..b81f820 100644 Binary files a/src-tauri/icons/Square142x142Logo.png and b/src-tauri/icons/Square142x142Logo.png differ diff --git a/src-tauri/icons/Square150x150Logo.png b/src-tauri/icons/Square150x150Logo.png index dc2b22c..624c7bf 100644 Binary files a/src-tauri/icons/Square150x150Logo.png and b/src-tauri/icons/Square150x150Logo.png differ diff --git a/src-tauri/icons/Square284x284Logo.png b/src-tauri/icons/Square284x284Logo.png index 0ed3984..c021d2b 100644 Binary files a/src-tauri/icons/Square284x284Logo.png and b/src-tauri/icons/Square284x284Logo.png differ diff --git a/src-tauri/icons/Square30x30Logo.png b/src-tauri/icons/Square30x30Logo.png index 60bf0ea..6219700 100644 Binary files a/src-tauri/icons/Square30x30Logo.png and b/src-tauri/icons/Square30x30Logo.png differ diff --git a/src-tauri/icons/Square310x310Logo.png b/src-tauri/icons/Square310x310Logo.png index c8ca0ad..f9bc048 100644 Binary files a/src-tauri/icons/Square310x310Logo.png and b/src-tauri/icons/Square310x310Logo.png differ diff --git a/src-tauri/icons/Square44x44Logo.png b/src-tauri/icons/Square44x44Logo.png index 8756459..d5fbfb2 100644 Binary files a/src-tauri/icons/Square44x44Logo.png and b/src-tauri/icons/Square44x44Logo.png differ diff --git a/src-tauri/icons/Square71x71Logo.png b/src-tauri/icons/Square71x71Logo.png index 2c8023c..63440d7 100644 Binary files a/src-tauri/icons/Square71x71Logo.png and b/src-tauri/icons/Square71x71Logo.png differ diff --git a/src-tauri/icons/Square89x89Logo.png b/src-tauri/icons/Square89x89Logo.png index 2c5e603..f3f705a 100644 Binary files a/src-tauri/icons/Square89x89Logo.png and b/src-tauri/icons/Square89x89Logo.png differ diff --git a/src-tauri/icons/StoreLogo.png b/src-tauri/icons/StoreLogo.png index 17d142c..4556388 100644 Binary files a/src-tauri/icons/StoreLogo.png and b/src-tauri/icons/StoreLogo.png differ diff --git a/src-tauri/icons/icon.icns b/src-tauri/icons/icon.icns index a2993ad..12a5bce 100644 Binary files a/src-tauri/icons/icon.icns and b/src-tauri/icons/icon.icns differ diff --git a/src-tauri/icons/icon.ico b/src-tauri/icons/icon.ico index 06c23c8..b3636e4 100644 Binary files a/src-tauri/icons/icon.ico and b/src-tauri/icons/icon.ico differ diff --git a/src-tauri/icons/icon.png b/src-tauri/icons/icon.png index d1756ce..e1cd261 100644 Binary files a/src-tauri/icons/icon.png and b/src-tauri/icons/icon.png differ diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 7c8e0e0..f643a37 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,12 +1,134 @@ // Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] +use tauri::{ + api::shell::open, AppHandle, CustomMenuItem, Manager, + SystemTray, SystemTrayEvent, SystemTrayMenu, + SystemTrayMenuItem, SystemTraySubmenu, +}; + +// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command +#[tauri::command] +fn greet(name: &str) -> String { + format!("Hello, {}! You've been greeted from Rust!", name) +} + + +const links: [(&str, &str, &str); 5] = [ + // social links + ("open-social-netlify", "Netlify","https://app.netlify.com/teams/christopherbiscardi/overview"), + ("open-social-youtube", "YouTube","https://www.youtube.com/@chrisbiscardi"), + ("open-social-twitter", "Twitter","https://twitter.com/"), + // github links + ("open-github-rust-adventure", "Rust Adventure","https://github.com/rust-adventure"), + ("open-github-bevy", "Bevy","https://github.com/bevyengine/bevy"), +]; + fn main() { - dotenvy::dotenv().expect(".env file not found"); + let sub_menu_social = { + let mut menu = SystemTrayMenu::new(); + for (id, label, _url) in + links.iter().filter(|(id, label, _url)| { + id.starts_with("open-social") + }) + { + menu = menu.add_item(CustomMenuItem::new( + id.to_string(), + label.to_string(), + )); + } - pretty_env_logger::env_logger::init(); - - tauri::Builder::default() - .run(tauri::generate_context!()) - .expect("error while running tauri application"); + SystemTraySubmenu::new("Social", menu) + }; + let sub_menu_github = { + let mut menu = SystemTrayMenu::new(); + for (id, label, _url) in + links.iter().filter(|(id, label, _url)| { + id.starts_with("open-github") + }) + { + menu = menu.add_item(CustomMenuItem::new( + id.to_string(), + label.to_string(), + )); + } + + SystemTraySubmenu::new("GitHub", menu) + }; + let tray_menu = SystemTrayMenu::new() + .add_item(CustomMenuItem::new( + "quit".to_string(), + "Quit", + )) + .add_submenu(sub_menu_social) + .add_submenu(sub_menu_github) + .add_native_item(SystemTrayMenuItem::Separator) + .add_item(CustomMenuItem::new( + "visibility-toggle".to_string(), + "Hide", + )); + + let tray = SystemTray::new().with_menu(tray_menu); + + tauri::Builder::default() + .invoke_handler(tauri::generate_handler![greet]) + .system_tray(tray) + .on_system_tray_event(on_system_tray_event) + .build(tauri::generate_context!()) + .expect("error while running tauri application") + .run(|_app_handle, event| match event { + tauri::RunEvent::ExitRequested { + api, .. + } => { + api.prevent_exit(); + } + _ => {} + }); } + +fn on_system_tray_event( + app: &AppHandle, + event: SystemTrayEvent, +) { + match event { + SystemTrayEvent::MenuItemClick { id, .. } => { + let item_handle = + app.tray_handle().get_item(&id); + dbg!(&id); + match id.as_str() { + "visibility-toggle" => { + let window = + app.get_window("main").unwrap(); + match window.is_visible() { + Ok(true) => { + window.hide().unwrap(); + item_handle.set_title("Show").unwrap(); + }, + Ok(false) => { + window.show(); + item_handle.set_title("Hide").unwrap(); + + }, + Err(e) => unimplemented!("what kind of errors happen here?"), + } + } + "quit" => app.exit(0), + s if s.starts_with("open-") => { + if let Some(link) = links + .iter() + .find(|(id, ..)| id == &s) + { + open( + &app.shell_scope(), + link.2, + None, + ) + .unwrap(); + } + } + _ => {} + } + } + _ => {} + } +} \ No newline at end of file diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 5c60e5d..2f46295 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,26 +1,41 @@ { "build": { - "beforeBuildCommand": "bun run build", "beforeDevCommand": "bun run dev", - "devPath": "http://localhost:3000", - "distDir": "../out" + "beforeBuildCommand": "bun run build", + "devPath": "http://localhost:1420", + "distDir": "../dist" }, "package": { "productName": "os1", - "version": "0.1.0" + "version": "0.0.0" }, "tauri": { + "systemTray": { + "iconPath": "icons/icon.png", + "iconAsTemplate": true + }, "allowlist": { - "all": false + "all": false, + "shell": { + "all": false, + "open": true + } + }, + "windows": [ + { + "title": "os1", + "width": 800, + "height": 600 + } + ], + "security": { + "csp": null }, "bundle": { "active": true, + "targets": "all", "category": "DeveloperTool", - "copyright": "", - "deb": { - "depends": [] - }, - "externalBin": [], + "identifier": "so.vic.os1", "icon": [ "icons/32x32.png", "icons/128x128.png", @@ -28,38 +43,13 @@ "icons/icon.icns", "icons/icon.ico" ], - "identifier": "com.tauri.dev", - "longDescription": "", "macOS": { "entitlements": null, "exceptionDomain": "", "frameworks": [], "providerShortName": null, "signingIdentity": null - }, - "resources": [], - "shortDescription": "", - "targets": "all", - "windows": { - "certificateThumbprint": null, - "digestAlgorithm": "sha256", - "timestampUrl": "" - } - }, - "security": { - "csp": null - }, - "updater": { - "active": false - }, - "windows": [ - { - "fullscreen": false, - "height": 600, - "resizable": true, - "title": "os1", - "width": 800 } - ] + } } } diff --git a/src/App.tsx b/src/App.tsx new file mode 100644 index 0000000..f32f4d4 --- /dev/null +++ b/src/App.tsx @@ -0,0 +1,40 @@ +import { useState } from "react"; +// import reactLogo from "./assets/react.svg"; +import { invoke } from "@tauri-apps/api/tauri"; +import { Input } from "./components/ui/input"; +import { Button } from "./components/ui/button"; + +function App() { + const [greetMsg, setGreetMsg] = useState(""); + const [name, setName] = useState(""); + + const greet=async()=> { + setGreetMsg(await invoke("greet", { name })); + } + + // bg-[#353535] + return ( +
    +
    +

    OS1

    +
    { + e.preventDefault(); + greet(); + }} + > + setName(e.currentTarget.value)} + placeholder="Enter a name..." + /> + +
    +

    {greetMsg}

    +
    +
    + ); +} + +export default App; diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx new file mode 100644 index 0000000..a033108 --- /dev/null +++ b/src/components/ui/button.tsx @@ -0,0 +1,56 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { cva, type VariantProps } from "class-variance-authority" + +import { tw } from "../../utils/tw" + +const buttonVariants = cva( + "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", + { + variants: { + variant: { + default: "bg-primary text-primary-foreground hover:bg-primary/90", + destructive: + "bg-destructive text-destructive-foreground hover:bg-destructive/90", + outline: + "border border-input bg-background hover:bg-accent hover:text-accent-foreground", + secondary: + "bg-secondary text-secondary-foreground hover:bg-secondary/80", + ghost: "hover:bg-accent hover:text-accent-foreground", + link: "text-primary underline-offset-4 hover:underline", + }, + size: { + default: "h-10 px-4 py-2", + sm: "h-9 rounded-md px-3", + lg: "h-11 rounded-md px-8", + icon: "h-10 w-10", + }, + }, + defaultVariants: { + variant: "default", + size: "default", + }, + } +) + +export interface ButtonProps + extends React.ButtonHTMLAttributes, + VariantProps { + asChild?: boolean +} + +const Button = React.forwardRef( + ({ className, variant, size, asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button" + return ( + + ) + } +) +Button.displayName = "Button" + +export { Button, buttonVariants } diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx new file mode 100644 index 0000000..91c4f46 --- /dev/null +++ b/src/components/ui/input.tsx @@ -0,0 +1,25 @@ +import * as React from "react" + +import { tw } from "../../utils/tw" + +export interface InputProps + extends React.InputHTMLAttributes {} + +const Input = React.forwardRef( + ({ className, type, ...props }, ref) => { + return ( + + ) + } +) +Input.displayName = "Input" + +export { Input } diff --git a/src/globals.css b/src/globals.css new file mode 100644 index 0000000..cfbc559 --- /dev/null +++ b/src/globals.css @@ -0,0 +1,77 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + :root { + --background: 0 0% 100%; + --foreground: 0 0% 3.9%; + + --card: 0 0% 100%; + --card-foreground: 0 0% 3.9%; + + --popover: 0 0% 100%; + --popover-foreground: 0 0% 3.9%; + + --primary: 0 0% 9%; + --primary-foreground: 0 0% 98%; + + --secondary: 0 0% 96.1%; + --secondary-foreground: 0 0% 9%; + + --muted: 0 0% 96.1%; + --muted-foreground: 0 0% 45.1%; + + --accent: 0 0% 96.1%; + --accent-foreground: 0 0% 9%; + + --destructive: 0 84.2% 60.2%; + --destructive-foreground: 0 0% 98%; + + --border: 0 0% 89.8%; + --input: 0 0% 89.8%; + --ring: 0 0% 3.9%; + + --radius: 0.5rem; + } + + .dark { + --background: 0 0% 3.9%; + --foreground: 0 0% 98%; + + --card: 0 0% 3.9%; + --card-foreground: 0 0% 98%; + + --popover: 0 0% 3.9%; + --popover-foreground: 0 0% 98%; + + --primary: 0 0% 98%; + --primary-foreground: 0 0% 9%; + + --secondary: 0 0% 14.9%; + --secondary-foreground: 0 0% 98%; + + --muted: 0 0% 14.9%; + --muted-foreground: 0 0% 63.9%; + + --accent: 0 0% 14.9%; + --accent-foreground: 0 0% 98%; + + --destructive: 0 62.8% 30.6%; + --destructive-foreground: 0 0% 98%; + + --border: 0 0% 14.9%; + --input: 0 0% 14.9%; + --ring: 0 0% 83.1%; + } +} + +@layer base { + * { + @apply border-border; + } + body { + /* @apply bg-foreground text-background; */ + @apply bg-[#353535] text-background; + } +} \ No newline at end of file diff --git a/src/main.tsx b/src/main.tsx new file mode 100644 index 0000000..9a80b77 --- /dev/null +++ b/src/main.tsx @@ -0,0 +1,10 @@ +import React from "react"; +import ReactDOM from "react-dom/client"; +import App from "./App"; +import "./globals.css"; + +ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render( + + + , +); diff --git a/src/utils/tw.ts b/src/utils/tw.ts new file mode 100644 index 0000000..d6c9aad --- /dev/null +++ b/src/utils/tw.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from "clsx" +import { twMerge } from "tailwind-merge" + +export const tw=(...inputs: ClassValue[]) => { + return twMerge(clsx(inputs)) +} \ No newline at end of file diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/tailwind.config.js b/tailwind.config.js deleted file mode 100644 index cf5c5a4..0000000 --- a/tailwind.config.js +++ /dev/null @@ -1,19 +0,0 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: [ - "./{app,components}/**/*.{ts,tsx}", - ], - theme: { - extend: { - colors: { - background: "hsl(var(--background))", - foreground: "hsl(var(--foreground))", - btn: { - background: "hsl(var(--btn-background))", - "background-hover": "hsl(var(--btn-background-hover))", - }, - }, - }, - }, - plugins: [], -}; diff --git a/tailwind.config.ts b/tailwind.config.ts new file mode 100644 index 0000000..84287e8 --- /dev/null +++ b/tailwind.config.ts @@ -0,0 +1,80 @@ +import type { Config } from "tailwindcss" + +const config = { + darkMode: ["class"], + content: [ + './pages/**/*.{ts,tsx}', + './components/**/*.{ts,tsx}', + './app/**/*.{ts,tsx}', + './src/**/*.{ts,tsx}', + ], + prefix: "", + theme: { + container: { + center: true, + padding: "2rem", + screens: { + "2xl": "1400px", + }, + }, + extend: { + colors: { + border: "hsl(var(--border))", + input: "hsl(var(--input))", + ring: "hsl(var(--ring))", + background: "hsl(var(--background))", + foreground: "hsl(var(--foreground))", + primary: { + DEFAULT: "hsl(var(--primary))", + foreground: "hsl(var(--primary-foreground))", + }, + secondary: { + DEFAULT: "hsl(var(--secondary))", + foreground: "hsl(var(--secondary-foreground))", + }, + destructive: { + DEFAULT: "hsl(var(--destructive))", + foreground: "hsl(var(--destructive-foreground))", + }, + muted: { + DEFAULT: "hsl(var(--muted))", + foreground: "hsl(var(--muted-foreground))", + }, + accent: { + DEFAULT: "hsl(var(--accent))", + foreground: "hsl(var(--accent-foreground))", + }, + popover: { + DEFAULT: "hsl(var(--popover))", + foreground: "hsl(var(--popover-foreground))", + }, + card: { + DEFAULT: "hsl(var(--card))", + foreground: "hsl(var(--card-foreground))", + }, + }, + borderRadius: { + lg: "var(--radius)", + md: "calc(var(--radius) - 2px)", + sm: "calc(var(--radius) - 4px)", + }, + keyframes: { + "accordion-down": { + from: { height: "0" }, + to: { height: "var(--radix-accordion-content-height)" }, + }, + "accordion-up": { + from: { height: "var(--radix-accordion-content-height)" }, + to: { height: "0" }, + }, + }, + animation: { + "accordion-down": "accordion-down 0.2s ease-out", + "accordion-up": "accordion-up 0.2s ease-out", + }, + }, + }, + plugins: [require("tailwindcss-animate")], +} satisfies Config + +export default config \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index d31cf1d..d5f9106 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,28 +1,29 @@ { "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, - "module": "esnext", - "moduleResolution": "node", + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "plugins": [ - { - "name": "next" - } - ], - "paths": { - "~/*": ["./*"] + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "baseUrl": "./src/", + "paths":{ + "~/*": ["./src/*"] } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules", "src-tauri"] + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] } diff --git a/tsconfig.node.json b/tsconfig.node.json new file mode 100644 index 0000000..42872c5 --- /dev/null +++ b/tsconfig.node.json @@ -0,0 +1,10 @@ +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/utils/supabase/client.ts b/utils/supabase/client.ts deleted file mode 100644 index e2660d0..0000000 --- a/utils/supabase/client.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { createBrowserClient } from "@supabase/ssr"; - -export const createClient = () => - createBrowserClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - ); diff --git a/utils/supabase/server.ts b/utils/supabase/server.ts deleted file mode 100644 index ecadfb1..0000000 --- a/utils/supabase/server.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { createServerClient, type CookieOptions } from "@supabase/ssr"; -import { cookies } from "next/headers"; - -export const createClient = () => { - const cookieStore = cookies(); - - return createServerClient( - process.env.NEXT_PUBLIC_SUPABASE_URL!, - process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!, - { - cookies: { - get(name: string) { - return cookieStore.get(name)?.value; - }, - set(name: string, value: string, options: CookieOptions) { - try { - cookieStore.set({ name, value, ...options }); - } catch (error) { - // The `set` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, - remove(name: string, options: CookieOptions) { - try { - cookieStore.set({ name, value: "", ...options }); - } catch (error) { - // The `delete` method was called from a Server Component. - // This can be ignored if you have middleware refreshing - // user sessions. - } - }, - }, - }, - ); -}; diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000..0c9adff --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,21 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; + +// https://vitejs.dev/config/ +export default defineConfig(async () => ({ + plugins: [react()], + + // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` + // + // 1. prevent vite from obscuring rust errors + clearScreen: false, + // 2. tauri expects a fixed port, fail if that port is not available + server: { + port: 1420, + strictPort: true, + watch: { + // 3. tell vite to ignore watching `src-tauri` + ignored: ["**/src-tauri/**"], + }, + }, +}));