diff --git a/.changeset/afraid-chefs-protect.md b/.changeset/afraid-chefs-protect.md new file mode 100644 index 00000000..16089d1e --- /dev/null +++ b/.changeset/afraid-chefs-protect.md @@ -0,0 +1,5 @@ +--- +"@tablex/core": patch +--- + +Removes the splash screen + replace background images with procedural ones to reduce bundle size diff --git a/apps/core/package.json b/apps/core/package.json index 6fe6f609..a10bc05c 100644 --- a/apps/core/package.json +++ b/apps/core/package.json @@ -47,6 +47,7 @@ "date-fns": "^3.6.0", "hotkeys-js": "^3.13.7", "lucide-react": "^0.292.0", + "mini-svg-data-uri": "^1.4.4", "react": "^18.3.1", "react-day-picker": "8.10.1", "react-dom": "^18.3.1", diff --git a/apps/core/public/connect.svg b/apps/core/public/connect.svg deleted file mode 100644 index 323c8733..00000000 --- a/apps/core/public/connect.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/apps/core/public/cube.svg b/apps/core/public/icons/cube.svg similarity index 100% rename from apps/core/public/cube.svg rename to apps/core/public/icons/cube.svg diff --git a/apps/core/public/icons/icon.svg b/apps/core/public/icons/icon.svg deleted file mode 100644 index 1a8a13e3..00000000 --- a/apps/core/public/icons/icon.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/apps/core/public/landing.svg b/apps/core/public/landing.svg deleted file mode 100644 index 7fbdd948..00000000 --- a/apps/core/public/landing.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/apps/core/public/splashscreen.html b/apps/core/public/splashscreen.html deleted file mode 100644 index ef3e2369..00000000 --- a/apps/core/public/splashscreen.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - Splash Screen - - -
-
-

Table

- icon -
-
- - - - \ No newline at end of file diff --git a/apps/core/public/splashscreen.svg b/apps/core/public/splashscreen.svg deleted file mode 100644 index 323c8733..00000000 --- a/apps/core/public/splashscreen.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/apps/core/src-tauri/src/cli.rs b/apps/core/src-tauri/src/cli.rs index bb7dfd96..163291ba 100644 --- a/apps/core/src-tauri/src/cli.rs +++ b/apps/core/src-tauri/src/cli.rs @@ -62,7 +62,6 @@ pub fn parse_cli_args() -> (Args, Command) { /// - If `--save` is set without `-c`. pub async fn handle_cli_args(app: &AppHandle, args: Args, mut cmd: Command) { let main_window = app.get_webview_window("main").unwrap(); - let splash_screen = app.get_webview_window("splashscreen").unwrap(); if let Some(conn_string) = args.conn_string { #[cfg(all(windows, not(dev)))] @@ -86,16 +85,12 @@ pub async fn handle_cli_args(app: &AppHandle, args: Args, mut cmd: Command) { #[cfg(all(windows, not(dev)))] free_console(); - splash_screen.show().unwrap(); - let url = format!( "/dashboard/land?connectionName={}", &args.conn_name.unwrap_or("Temp".into()) ); let _ = main_window.eval(format!("window.location.replace('{url}')").as_str()); } else { - splash_screen.show().unwrap(); - normal_navigation(app, main_window); } } diff --git a/apps/core/src-tauri/src/main.rs b/apps/core/src-tauri/src/main.rs index 40e373b9..b032ddd6 100644 --- a/apps/core/src-tauri/src/main.rs +++ b/apps/core/src-tauri/src/main.rs @@ -14,27 +14,13 @@ use commands::{connection::*, fs::*, row::*, table::*}; #[cfg(debug_assertions)] use specta_typescript::{BigIntExportBehavior, Typescript}; use state::SharedState; -use tauri::{async_runtime::Mutex, AppHandle, Manager, Window, WindowEvent}; +use tauri::{async_runtime::Mutex, AppHandle, Manager, WindowEvent}; use tauri_plugin_log::{RotationStrategy, Target, TargetKind, TimezoneStrategy}; use tauri_specta::{collect_commands, collect_events, Builder}; use tx_keybindings::*; use tx_lib::{events::*, TxError}; use tx_settings::*; -#[tauri::command] -#[specta::specta] -fn close_splashscreen(window: Window) { - if let Some(splashscreen) = window.get_webview_window("splashscreen") { - splashscreen.close().unwrap(); - - window - .get_webview_window("main") - .expect("no window labeled 'main' found") - .show() - .unwrap(); - } -} - fn ensure_config_files_exist(app: &AppHandle) -> Result<(), TxError> { ensure_settings_file_exist(&get_settings_file_path(app)?)?; ensure_keybindings_file_exist(&get_keybindings_file_path(app)?)?; @@ -86,7 +72,6 @@ fn main() { .constant("KEYBINDINGS_FILE_NAME", KEYBINDINGS_FILE_NAME) .constant("SETTINGS_FILE_NAME", SETTINGS_FILE_NAME) .commands(collect_commands![ - close_splashscreen, kill_metax, // Connection commands. test_connection, @@ -138,7 +123,6 @@ fn main() { let rt = tokio::runtime::Runtime::new().unwrap(); ensure_config_files_exist(app_handle)?; - let _settings = load_settings_file(app_handle.clone())?; builder.mount_events(app); @@ -154,7 +138,10 @@ fn main() { #[cfg(feature = "updater")] { app_handle.plugin(tauri_plugin_updater::Builder::new().build())?; - if _settings.check_for_updates { + + let settings = load_settings_file(app_handle.clone())?; + + if settings.check_for_updates { updater::check_for_update(app_handle.clone())?; } } diff --git a/apps/core/src-tauri/tauri.conf.json b/apps/core/src-tauri/tauri.conf.json index 32857517..a67f056e 100644 --- a/apps/core/src-tauri/tauri.conf.json +++ b/apps/core/src-tauri/tauri.conf.json @@ -48,18 +48,7 @@ "resizable": true, "title": "TableX", "width": 800, - "center": true, - "visible": false - }, - { - "width": 600, - "height": 350, - "decorations": false, - "url": "splashscreen.html", - "label": "splashscreen", - "center": true, - "visible": false - } + "center": true } ], "security": { "csp": null, diff --git a/apps/core/src/bindings.ts b/apps/core/src/bindings.ts index fa2b4d80..28d2a270 100644 --- a/apps/core/src/bindings.ts +++ b/apps/core/src/bindings.ts @@ -5,9 +5,6 @@ export const commands = { -async closeSplashscreen() : Promise { - await TAURI_INVOKE("close_splashscreen"); -}, async killMetax() : Promise> { try { return { status: "ok", data: await TAURI_INVOKE("kill_metax") }; diff --git a/apps/core/src/components/create-connection-btn.tsx b/apps/core/src/components/create-connection-btn.tsx index 4367aaa0..dfd35b78 100644 --- a/apps/core/src/components/create-connection-btn.tsx +++ b/apps/core/src/components/create-connection-btn.tsx @@ -7,7 +7,7 @@ const CreateConnectionBtn = () => { return (

Start a connection

diff --git a/apps/core/src/routes/__root.tsx b/apps/core/src/routes/__root.tsx index 19c62e53..33e01d41 100644 --- a/apps/core/src/routes/__root.tsx +++ b/apps/core/src/routes/__root.tsx @@ -1,4 +1,3 @@ -import { commands } from "@/bindings" import { createRootRoute, Outlet } from "@tanstack/react-router" import React, { Suspense } from "react" import { Toaster } from "react-hot-toast" @@ -14,7 +13,6 @@ const TanStackRouterDevtools = ) export const Route = createRootRoute({ - onEnter: commands.closeSplashscreen, component: () => { return (
diff --git a/apps/core/src/routes/connect/-components/driver-selector.tsx b/apps/core/src/routes/connect/-components/driver-selector.tsx new file mode 100644 index 00000000..f5c5d888 --- /dev/null +++ b/apps/core/src/routes/connect/-components/driver-selector.tsx @@ -0,0 +1,70 @@ +import type { Drivers } from "@/bindings" +import { Button } from "@/components/ui/button" +import { Command, CommandGroup, CommandItem } from "@/components/ui/command" +import { + Popover, + PopoverContent, + PopoverTrigger +} from "@/components/ui/popover" +import { MappedDrivers } from "@/lib/types" +import { cn } from "@tablex/lib/utils" +import { Check, ChevronsUpDown } from "lucide-react" +import { useState, type Dispatch, type SetStateAction } from "react" + +type Props = { + selectedDriver: Drivers | null + setSelectedDriver: Dispatch> +} +const DriverSelector = ({ selectedDriver, setSelectedDriver }: Props) => { + const [isPopoverOpen, setIsPopoverOpen] = useState(false) + + return ( + + + + + + + + {MappedDrivers.map((driver) => ( + { + setSelectedDriver( + currentValue === selectedDriver + ? null + : (currentValue as Drivers) + ) + setIsPopoverOpen(false) + }} + > + + {driver.label} + + ))} + + + + + ) +} + +export default DriverSelector diff --git a/apps/core/src/routes/connect/route.tsx b/apps/core/src/routes/connect/route.tsx index b0a4f72b..ab94116a 100644 --- a/apps/core/src/routes/connect/route.tsx +++ b/apps/core/src/routes/connect/route.tsx @@ -1,16 +1,7 @@ import { Drivers } from "@/bindings" -import { Button } from "@/components/ui/button" -import { Command, CommandGroup, CommandItem } from "@/components/ui/command" -import { - Popover, - PopoverContent, - PopoverTrigger -} from "@/components/ui/popover" -import { MappedDrivers } from "@/lib/types" -import { cn } from "@tablex/lib/utils" import { createFileRoute } from "@tanstack/react-router" -import { Check, ChevronsUpDown } from "lucide-react" import { useState } from "react" +import DriverSelector from "./-components/driver-selector" import PgMySQLConnection from "./-components/pg-mysql-connection" import SqliteConnection from "./-components/sqlite-connection" @@ -19,66 +10,20 @@ export const Route = createFileRoute("/connect")({ }) function CreateConnection() { - const [isPopoverOpen, setIsPopoverOpen] = useState(false) const [selectedDriver, setSelectedDriver] = useState(null) + return ( -
- - - - - - - - {MappedDrivers.map((driver) => ( - { - setSelectedDriver( - currentValue === selectedDriver - ? null - : (currentValue as Drivers) - ) - setIsPopoverOpen(false) - }} - > - - {driver.label} - - ))} - - - - +
+ {selectedDriver === "sqlite" ? ( ) : ( selectedDriver && )} - bg +
) } diff --git a/apps/core/src/routes/connections/route.tsx b/apps/core/src/routes/connections/route.tsx index e7e925f5..ff991ba0 100644 --- a/apps/core/src/routes/connections/route.tsx +++ b/apps/core/src/routes/connections/route.tsx @@ -101,20 +101,15 @@ function ConnectionsPage() { })} -
) diff --git a/apps/core/src/routes/dashboard/_layout/land/route.tsx b/apps/core/src/routes/dashboard/_layout/land/route.tsx index 41378cbd..81804581 100644 --- a/apps/core/src/routes/dashboard/_layout/land/route.tsx +++ b/apps/core/src/routes/dashboard/_layout/land/route.tsx @@ -7,7 +7,7 @@ export const Route = createFileRoute("/dashboard/_layout/land")({ function DashboardPage() { return (
- cube + cube Choose a table
to get started diff --git a/apps/core/src/routes/index/route.tsx b/apps/core/src/routes/index/route.tsx index a1e98f25..d26640f7 100644 --- a/apps/core/src/routes/index/route.tsx +++ b/apps/core/src/routes/index/route.tsx @@ -7,25 +7,20 @@ export const Route = createFileRoute("/")({ function Index() { return ( -
+
+
-

Table

+

+ Table +

logo
- bg
) } diff --git a/apps/core/tailwind.config.ts b/apps/core/tailwind.config.ts index b7d3400f..ec678108 100644 --- a/apps/core/tailwind.config.ts +++ b/apps/core/tailwind.config.ts @@ -1,6 +1,10 @@ import { tablexTailwindPreset } from "@tablex/tailwind" import type { Config } from "tailwindcss" +import svgToDataUri from "mini-svg-data-uri" + +import flattenColorPalette from "tailwindcss/lib/util/flattenColorPalette" + const config: Config = { darkMode: ["selector"], content: [ @@ -8,7 +12,31 @@ const config: Config = { "./app/**/*.{ts,tsx}", "./src/**/*.{ts,tsx}" ], - presets: [tablexTailwindPreset] + presets: [tablexTailwindPreset], + plugins: [ + function ({ matchUtilities, theme }: any) { + matchUtilities( + { + "bg-grid": (value: any) => ({ + backgroundImage: `url("${svgToDataUri( + `` + )}")` + }), + "bg-grid-small": (value: any) => ({ + backgroundImage: `url("${svgToDataUri( + `` + )}")` + }), + "bg-dot": (value: any) => ({ + backgroundImage: `url("${svgToDataUri( + `` + )}")` + }) + }, + { values: flattenColorPalette(theme("backgroundColor")), type: "color" } + ) + } + ] } export default config diff --git a/apps/web/src/sections/Features/cards/cli.tsx b/apps/web/src/sections/Features/cards/cli.tsx index 58739259..428c21af 100644 --- a/apps/web/src/sections/Features/cards/cli.tsx +++ b/apps/web/src/sections/Features/cards/cli.tsx @@ -1,6 +1,6 @@ const CLI = () => { return ( -
+
diff --git a/apps/web/src/sections/Footer/Footer.astro b/apps/web/src/sections/Footer/Footer.astro index 7754ab84..b8f2e01c 100644 --- a/apps/web/src/sections/Footer/Footer.astro +++ b/apps/web/src/sections/Footer/Footer.astro @@ -3,7 +3,7 @@ ---

Developed by{" "} diff --git a/apps/web/src/sections/Heading/Heading.astro b/apps/web/src/sections/Heading/Heading.astro index 619522b7..8f11d55c 100644 --- a/apps/web/src/sections/Heading/Heading.astro +++ b/apps/web/src/sections/Heading/Heading.astro @@ -66,7 +66,7 @@ import DownloadBtn from "./download-btn"