From 58a7c09680990240177f7be1c32be73bc9931394 Mon Sep 17 00:00:00 2001 From: Yann Amsellem Date: Thu, 10 Apr 2025 13:07:45 +0200 Subject: [PATCH] feat(native): switch engine --- src-tauri/tauri.conf.json | 3 +- src/lib/components/ProxySwitch.svelte | 69 +++++++++++++++++++++++++++ src/lib/components/SideBar.svelte | 34 ++++++++----- src/lib/olap-engine/index.ts | 5 +- 4 files changed, 98 insertions(+), 13 deletions(-) create mode 100644 src/lib/components/ProxySwitch.svelte diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 06a915a..bbf7521 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -40,7 +40,8 @@ "width": 1250, "height": 900, "theme": "Dark", - "useHttpsScheme": true + "useHttpsScheme": true, + "backgroundColor": "#000000" } ] } diff --git a/src/lib/components/ProxySwitch.svelte b/src/lib/components/ProxySwitch.svelte new file mode 100644 index 0000000..e7ce68d --- /dev/null +++ b/src/lib/components/ProxySwitch.svelte @@ -0,0 +1,69 @@ + + +
+ + +
+ + diff --git a/src/lib/components/SideBar.svelte b/src/lib/components/SideBar.svelte index 516d41a..fbab74e 100644 --- a/src/lib/components/SideBar.svelte +++ b/src/lib/components/SideBar.svelte @@ -4,6 +4,7 @@ import type { Query } from '$lib/repositories/queries'; import Datasets from './Datasets/Datasets.svelte'; import History from './History.svelte'; + import ProxySwitch from './ProxySwitch.svelte'; import Queries from './Queries/Queries.svelte'; type Tab = 'sources' | 'queries' | 'history'; @@ -44,14 +45,19 @@ - {#if tab === 'sources'} - - {/if} - {#if tab === 'queries'} - - {/if} - {#if tab === 'history'} - +
+ {#if tab === 'sources'} + + {/if} + {#if tab === 'queries'} + + {/if} + {#if tab === 'history'} + + {/if} +
+ {#if PLATFORM === 'NATIVE'} + {/if} @@ -62,15 +68,16 @@ padding: 14px 20px 0; background-color: hsl(0deg 0% 5%); - display: flex; - flex-direction: column; - gap: 18px; border-right: 1px solid hsl(0deg 0% 20%); + + display: grid; + grid-template-rows: minmax(0, auto) 1fr minmax(0, auto); } nav { display: flex; justify-content: space-between; + margin-bottom: 18px; & > button { font-size: 11px; @@ -86,6 +93,11 @@ } } + div { + display: flex; + flex-direction: column; + } + button { appearance: none; outline: none; diff --git a/src/lib/olap-engine/index.ts b/src/lib/olap-engine/index.ts index d9fd7d1..f8d499e 100644 --- a/src/lib/olap-engine/index.ts +++ b/src/lib/olap-engine/index.ts @@ -33,4 +33,7 @@ export interface OLAPEngine extends IListener { getUDFs(): Promise; } -export const engine: OLAPEngine = PLATFORM === 'WEB' ? new RemoteEngine() : new CHDBEngine(); +export const engine: OLAPEngine = + PLATFORM === 'WEB' || (typeof window !== 'undefined' && window.location.search.includes('proxy=')) + ? new RemoteEngine() + : new CHDBEngine();