fixed windows issues

This commit is contained in:
DecDuck
2024-10-09 17:55:19 +11:00
parent 0c0cfebc1e
commit 959dad383e
11 changed files with 40 additions and 28 deletions

View File

@ -2,6 +2,17 @@
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
html,
body {
-ms-overflow-style: none; /* IE and Edge /
scrollbar-width: none; / Firefox */
}
/* Hide scrollbar for Chrome, Safari and Opera */
html::-webkit-scrollbar {
display: none;
}
$motiva: ( $motiva: (
("MotivaSansThin.ttf", "ttf", 100, normal), ("MotivaSansThin.ttf", "ttf", 100, normal),
("MotivaSansLight.woff.ttf", "woff", 300, normal), ("MotivaSansLight.woff.ttf", "woff", 300, normal),

View File

@ -1,9 +1,9 @@
<template> <template>
<div <div class="h-16 cursor-pointer bg-gray-950 flex flex-row justify-between">
@mousedown="() => window.startDragging()" <div
class="h-16 cursor-pointer bg-gray-950 flex flex-row justify-between" @mousedown="() => window.startDragging()"
> class="flex flex-row grow items-center justify-between pl-5 pr-2 py-3"
<div class="flex flex-row grow items-center justify-between pl-5 pr-2 py-3"> >
<div class="inline-flex items-center gap-x-10"> <div class="inline-flex items-center gap-x-10">
<Wordmark class="h-8 mb-0.5" /> <Wordmark class="h-8 mb-0.5" />
<nav class="inline-flex items-center mt-0.5"> <nav class="inline-flex items-center mt-0.5">

View File

@ -38,15 +38,16 @@
<div class="h-0.5 rounded-full w-full bg-zinc-800" /> <div class="h-0.5 rounded-full w-full bg-zinc-800" />
<div class="flex flex-col mb-1"> <div class="flex flex-col mb-1">
<MenuItem v-slot="{ active }"> <MenuItem v-slot="{ active }">
<NuxtLink <a
@click="() => openAdminUrl()" :href="adminUrl"
target="_blank"
:class="[ :class="[
active ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400', active ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400',
'transition block px-4 py-2 text-sm', 'transition block px-4 py-2 text-sm',
]" ]"
> >
Admin Dashboard Admin Dashboard
</NuxtLink> </a>
</MenuItem> </MenuItem>
<MenuItem v-for="(nav, navIdx) in navigation" v-slot="{ active }"> <MenuItem v-for="(nav, navIdx) in navigation" v-slot="{ active }">
<NuxtLink <NuxtLink
@ -82,10 +83,6 @@ const adminUrl: string = await invoke("gen_drop_url", {
path: "/admin", path: "/admin",
}); });
async function openAdminUrl() {
await invoke("open_url", { path: adminUrl });
}
const navigation: NavigationItem[] = [ const navigation: NavigationItem[] = [
{ {
label: "Account settings", label: "Account settings",

View File

@ -1,9 +1,8 @@
<template> <template>
<div <div
@mousedown="() => window.startDragging()"
class="h-10 cursor-pointer flex flex-row items-center justify-between bg-zinc-950" class="h-10 cursor-pointer flex flex-row items-center justify-between bg-zinc-950"
> >
<div class="px-5 py-3"> <div class="px-5 py-3" @mousedown="() => window.startDragging()">
<Wordmark class="mt-1" /> <Wordmark class="mt-1" />
</div> </div>
<WindowControl /> <WindowControl />

View File

@ -1,5 +1,5 @@
<template> <template>
<HeaderButton @click="() => window.close()"> <HeaderButton @click="() => close()">
<XMarkIcon /> <XMarkIcon />
</HeaderButton> </HeaderButton>
</template> </template>
@ -8,5 +8,11 @@
import { MinusIcon, XMarkIcon } from "@heroicons/vue/16/solid"; import { MinusIcon, XMarkIcon } from "@heroicons/vue/16/solid";
import { getCurrentWindow } from "@tauri-apps/api/window"; import { getCurrentWindow } from "@tauri-apps/api/window";
async function close(){
console.log(window);
const result = await window.close();
console.log(`closed window: ${result}`);
}
const window = getCurrentWindow(); const window = getCurrentWindow();
</script> </script>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex flex-col bg-zinc-900 overflow-hidden"> <div class="flex flex-col bg-zinc-900 overflow-hidden">
<Header class="select-none" /> <Header class="select-none" />
<div class="grow overflow-y-scroll"> <div class="grow overflow-y-auto">
<slot /> <slot />
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="flex flex-col bg-zinc-950 overflow-hidden"> <div class="flex flex-col bg-zinc-950 overflow-hidden">
<MiniHeader /> <MiniHeader />
<div class="grow overflow-y-scroll"> <div class="grow overflow-y-auto">
<slot /> <slot />
</div> </div>
</div> </div>

View File

@ -12,8 +12,7 @@
Let's get you set up Let's get you set up
</h1> </h1>
<p class="mt-6 text-lg leading-8 text-zinc-400"> <p class="mt-6 text-lg leading-8 text-zinc-400">
Anim aute id magna aliqua ad ad non deserunt sunt. Qui irure qui lorem You'll need to have set up a Drop instance and created an account on it. If you're connecting to another person's instance, you'll need the url and an account.
cupidatat commodo. Elit sunt amet fugiat veniam occaecat fugiat aliqua.
</p> </p>
<div class="mt-10 flex items-center justify-center gap-x-6"> <div class="mt-10 flex items-center justify-center gap-x-6">
<NuxtLink <NuxtLink

View File

@ -24,7 +24,7 @@
class="flex rounded-md shadow-sm ring-1 ring-inset ring-zinc-700 focus-within:ring-2 focus-within:ring-inset focus-within:ring-blue-600 sm:max-w-md" class="flex rounded-md shadow-sm ring-1 ring-inset ring-zinc-700 focus-within:ring-2 focus-within:ring-inset focus-within:ring-blue-600 sm:max-w-md"
> >
<span <span
v-if="!url.startsWith('http')" v-if="showHttps"
class="flex select-none items-center pl-3 text-zinc-500 -mr-2.5 sm:text-sm" class="flex select-none items-center pl-3 text-zinc-500 -mr-2.5 sm:text-sm"
>https://</span >https://</span
> >
@ -87,6 +87,13 @@ const error = ref(undefined);
const loading = ref(false); const loading = ref(false);
const router = useRouter(); const router = useRouter();
const showHttps = computed(() => {
const prefixes = ["http://", "https://"];
const doesntHavePrefix = prefixes.findIndex((e) => url.value.startsWith(e.slice(0, url.value.length))) == -1;
return doesntHavePrefix;
})
async function connect() { async function connect() {
const newUrl = url.value.startsWith("http") const newUrl = url.value.startsWith("http")

View File

@ -12,7 +12,7 @@ use std::{
use auth::{auth_initiate, recieve_handshake}; use auth::{auth_initiate, recieve_handshake};
use data::DatabaseInterface; use data::DatabaseInterface;
use log::info; use log::info;
use remote::{gen_drop_url, open_url, use_remote}; use remote::{gen_drop_url, use_remote};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use structured_logger::{json::new_writer, Builder}; use structured_logger::{json::new_writer, Builder};
use tauri_plugin_deep_link::DeepLinkExt; use tauri_plugin_deep_link::DeepLinkExt;
@ -91,7 +91,6 @@ pub fn run() {
auth_initiate, auth_initiate,
use_remote, use_remote,
gen_drop_url, gen_drop_url,
open_url,
]) ])
.plugin(tauri_plugin_shell::init()) .plugin(tauri_plugin_shell::init())
.setup(|app| { .setup(|app| {

View File

@ -62,12 +62,6 @@ pub async fn use_remote<'a>(
return Ok(()); return Ok(());
} }
#[tauri::command]
pub fn open_url(path: String) -> Result<(), String> {
webbrowser::open(&path).unwrap();
Ok(())
}
#[tauri::command] #[tauri::command]
pub fn gen_drop_url(app: tauri::AppHandle, path: String) -> Result<String, String> { pub fn gen_drop_url(app: tauri::AppHandle, path: String) -> Result<String, String> {
let base_url = { let base_url = {