From a898e3013f877ada475ae60aba6bfbeaebb907b1 Mon Sep 17 00:00:00 2001 From: Ren Amamiya <123083837+reyamir@users.noreply.github.com> Date: Sun, 30 Jul 2023 21:11:44 +0700 Subject: [PATCH] updated --- index.html | 2 +- package.json | 2 +- pnpm-lock.yaml | 8 ++--- src-tauri/src/main.rs | 34 +------------------- src-tauri/src/window_ext.rs | 60 ---------------------------------- src-tauri/tauri.conf.json | 3 +- src/app.tsx | 3 -- src/app/auth/welcome.tsx | 35 ++++---------------- src/shared/authLayout.tsx | 64 +++---------------------------------- 9 files changed, 20 insertions(+), 191 deletions(-) delete mode 100644 src-tauri/src/window_ext.rs diff --git a/index.html b/index.html index ad4041da..d28ffb72 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Lume - +
diff --git a/package.json b/package.json index a908982e..ba733a71 100644 --- a/package.json +++ b/package.json @@ -93,7 +93,7 @@ "eslint": "^8.46.0", "eslint-config-prettier": "^8.9.0", "eslint-plugin-jsx-a11y": "^6.7.1", - "eslint-plugin-react": "^7.33.0", + "eslint-plugin-react": "^7.33.1", "eslint-plugin-simple-import-sort": "^10.0.0", "husky": "^8.0.3", "lint-staged": "^13.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5809b971..c427165d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -226,8 +226,8 @@ devDependencies: specifier: ^6.7.1 version: 6.7.1(eslint@8.46.0) eslint-plugin-react: - specifier: ^7.33.0 - version: 7.33.0(eslint@8.46.0) + specifier: ^7.33.1 + version: 7.33.1(eslint@8.46.0) eslint-plugin-simple-import-sort: specifier: ^10.0.0 version: 10.0.0(eslint@8.46.0) @@ -3756,8 +3756,8 @@ packages: semver: 6.3.1 dev: true - /eslint-plugin-react@7.33.0(eslint@8.46.0): - resolution: {integrity: sha512-qewL/8P34WkY8jAqdQxsiL82pDUeT7nhs8IsuXgfgnsEloKCT4miAV9N9kGtx7/KM9NH/NCGUE7Edt9iGxLXFw==} + /eslint-plugin-react@7.33.1(eslint@8.46.0): + resolution: {integrity: sha512-L093k0WAMvr6VhNwReB8VgOq5s2LesZmrpPdKz/kZElQDzqS7G7+DnKoqT+w4JwuiGeAhAvHO0fvy0Eyk4ejDA==} engines: {node: '>=4'} peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9d6370a2..1b331f88 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -3,20 +3,11 @@ windows_subsystem = "windows" )] -#[cfg(target_os = "macos")] -#[macro_use] -extern crate objc; - // use rand::distributions::{Alphanumeric, DistString}; -use tauri::{Manager, WindowEvent}; +use tauri::{Manager}; use tauri_plugin_autostart::MacosLauncher; use tauri_plugin_sql::{Migration, MigrationKind}; -#[cfg(target_os = "macos")] -use window_ext::WindowExt; -#[cfg(target_os = "macos")] -mod window_ext; - #[derive(Clone, serde::Serialize)] struct Payload { args: Vec, @@ -144,29 +135,6 @@ fn main() { .plugin(tauri_plugin_process::init()) .plugin(tauri_plugin_os::init()) .plugin(tauri_plugin_window::init()) - .setup(|app| { - #[cfg(target_os = "macos")] - let main_window = app.get_window("main").unwrap(); - - #[cfg(target_os = "macos")] - main_window.position_traffic_lights(13.0, 17.0); // set inset for traffic lights (macos) - - Ok(()) - }) - .on_window_event(|e| { - #[cfg(target_os = "macos")] - let apply_offset = || { - let win = e.window(); - // keep inset for traffic lights when window resize (macos) - win.position_traffic_lights(13.0, 17.0); - }; - #[cfg(target_os = "macos")] - match e.event() { - WindowEvent::Resized(..) => apply_offset(), - WindowEvent::ThemeChanged(..) => apply_offset(), - _ => {} - } - }) .run(tauri::generate_context!()) .expect("error while running tauri application"); } diff --git a/src-tauri/src/window_ext.rs b/src-tauri/src/window_ext.rs deleted file mode 100644 index f0789039..00000000 --- a/src-tauri/src/window_ext.rs +++ /dev/null @@ -1,60 +0,0 @@ -use tauri::{Runtime, Window}; - -pub trait WindowExt { - #[cfg(target_os = "macos")] - fn set_transparent_titlebar(&self, transparent: bool); - fn position_traffic_lights(&self, x: f64, y: f64); -} - -impl WindowExt for Window { - #[cfg(target_os = "macos")] - fn set_transparent_titlebar(&self, transparent: bool) { - use cocoa::appkit::{NSWindow, NSWindowTitleVisibility}; - - let window = self.ns_window().unwrap() as cocoa::base::id; - - unsafe { - window.setTitleVisibility_(NSWindowTitleVisibility::NSWindowTitleHidden); - - if transparent { - window.setTitlebarAppearsTransparent_(cocoa::base::YES); - } else { - window.setTitlebarAppearsTransparent_(cocoa::base::NO); - } - } - } - - #[cfg(target_os = "macos")] - fn position_traffic_lights(&self, x: f64, y: f64) { - use cocoa::appkit::{NSView, NSWindow, NSWindowButton}; - use cocoa::foundation::NSRect; - - let window = self.ns_window().unwrap() as cocoa::base::id; - - unsafe { - let close = window.standardWindowButton_(NSWindowButton::NSWindowCloseButton); - let miniaturize = window.standardWindowButton_(NSWindowButton::NSWindowMiniaturizeButton); - let zoom = window.standardWindowButton_(NSWindowButton::NSWindowZoomButton); - - let title_bar_container_view = close.superview().superview(); - - let close_rect: NSRect = msg_send![close, frame]; - let button_height = close_rect.size.height; - - let title_bar_frame_height = button_height + y; - let mut title_bar_rect = NSView::frame(title_bar_container_view); - title_bar_rect.size.height = title_bar_frame_height; - title_bar_rect.origin.y = NSView::frame(window).size.height - title_bar_frame_height; - let _: () = msg_send![title_bar_container_view, setFrame: title_bar_rect]; - - let window_buttons = vec![close, miniaturize, zoom]; - let space_between = NSView::frame(miniaturize).origin.x - NSView::frame(close).origin.x; - - for (i, button) in window_buttons.into_iter().enumerate() { - let mut rect: NSRect = NSView::frame(button); - rect.origin.x = x + (i as f64 * space_between); - button.setFrameOrigin(rect.origin); - } - } - } -} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a9b2dd38..5dea0d88 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -104,7 +104,8 @@ "title": "Lume", "titleBarStyle": "Overlay", "transparent": false, - "width": 1080 + "width": 1080, + "center": true } ] } diff --git a/src/app.tsx b/src/app.tsx index 997d6c97..0c32dfed 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -38,7 +38,6 @@ const router = createBrowserRouter([ { path: '/', element: ( - // @ts-expect-error, todo @@ -79,7 +78,6 @@ const router = createBrowserRouter([ { path: '/app', element: ( - // @ts-expect-error, todo @@ -96,7 +94,6 @@ const router = createBrowserRouter([ { path: '/settings', element: ( - // @ts-expect-error, todo diff --git a/src/app/auth/welcome.tsx b/src/app/auth/welcome.tsx index cfbf9fa6..504773e2 100644 --- a/src/app/auth/welcome.tsx +++ b/src/app/auth/welcome.tsx @@ -4,23 +4,12 @@ import { ArrowRightCircleIcon } from '@shared/icons/arrowRightCircle'; export function WelcomeScreen() { return ( -
-
-
-

- Preserve your freedom -

-

- Protect your future -

-

- Stack bitcoin -

-

- Use nostr -

-
-
+
+
+

Have fun together!

+
+
+
-
-
); } diff --git a/src/shared/authLayout.tsx b/src/shared/authLayout.tsx index 6af60868..1a084186 100644 --- a/src/shared/authLayout.tsx +++ b/src/shared/authLayout.tsx @@ -1,65 +1,11 @@ -import { platform } from '@tauri-apps/plugin-os'; -import { Outlet, useNavigate } from 'react-router-dom'; - -import { ArrowLeftIcon, ArrowRightIcon } from '@shared/icons'; - -const platformName = await platform(); +import { Outlet } from 'react-router-dom' export function AuthLayout() { - const navigate = useNavigate(); - - const goBack = () => { - navigate(-1); - }; - - const goForward = () => { - navigate(1); - }; - return ( -
-
-
-
-
- - -
-
-
-
- -
+
+
+
+
);