diff --git a/control/frontend/src/routes/ControlView.svelte b/control/frontend/src/routes/ControlView.svelte index 34413f4..a2ccdb2 100644 --- a/control/frontend/src/routes/ControlView.svelte +++ b/control/frontend/src/routes/ControlView.svelte @@ -9,18 +9,26 @@ Presentation, SquareTerminal, TextAlignStart, - TrafficCone + TrafficCone, + Globe } from 'lucide-svelte'; import Button from '$lib/components/Button.svelte'; import PopUp from '$lib/components/PopUp.svelte'; import type { PopupContent } from '$lib/ts/types'; import KeyInput from './KeyInput.svelte'; - import { send_keyboard_input, show_blackscreen, shutdown, startup } from '$lib/ts/api_handler'; + import { + send_keyboard_input, + show_blackscreen, + shutdown, + startup, + show_html + } from '$lib/ts/api_handler'; import { get_display_by_id, run_on_all_selected_displays } from '$lib/ts/stores/displays'; import { selected_display_ids } from '$lib/ts/stores/select'; import TipTapInput from './TipTapInput.svelte'; import { db } from '$lib/ts/database'; import { liveQuery, type Observable } from 'dexie'; + import TextInput from '$lib/components/TextInput.svelte'; let all_display_states: Observable<'on' | 'off' | 'mixed'> | undefined = $state(); $effect(() => { @@ -60,6 +68,17 @@ }; }; + const show_website_popup = () => { + popup_content = { + open: true, + snippet: website_popup, + title: 'Webseite anzeigen', + window_class: 'w-xl', + title_icon: Globe, + closable: true + }; + }; + async function all_state(selected_display_ids: string[]): Promise<'on' | 'off' | 'mixed'> { const selected_displays = await Promise.all( selected_display_ids.map(async (id) => await get_display_by_id(id)) @@ -116,8 +135,51 @@ 10 ); } + let website_url = $state(''); + let website_url_valid = $state(false); + + function validate_website_url(url: string): [boolean, string] { + if (url === '') return [true, '']; + const regex = /^https?:\/\/[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/; + if (regex.test(url)) { + return [true, '']; + } + return [false, 'Ungültige URL']; + } + + async function send_website() { + popup_content.open = false; + await run_on_all_selected_displays((d) => + show_html(d.ip, ``) + ); + website_url = ''; + } +{#snippet website_popup()} +
Bist du sicher, dass du alle ausgewählten Displays herunterfahren möchtest?
@@ -176,6 +238,12 @@ click_function={show_text_popup}>