Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 6 additions & 20 deletions src/lib/stores/full-screen.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
import { page } from '$app/stores';
import { get, writable } from 'svelte/store';
import { derived } from 'svelte/store';

const getQueryParam = () => !!+get(page).query.has('fullScreen');
const setQueryParam = (status: boolean): boolean => {
const query = new URLSearchParams();
if (status) {
query.append('fullScreen', '1');
} else {
query.delete('fullScreen');
}
history.pushState(null, '', `?${query}`);
return status;
};

const { subscribe, update } = writable(false, function (set) {
set(getQueryParam());
export const isFullScreen = derived(page, ($page) => {
const { query } = $page;
if (!query.has('fullScreen')) return false;
if (query.get('fullScreen') === 'false') return false;
return true;
});

export const isFullScreen = {
subscribe,
toggle: (): void => update((status) => setQueryParam(!status)),
};
7 changes: 5 additions & 2 deletions src/routes/workflows/[workflow]/[run].svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@
<script lang="typescript">
import { isFullScreen } from '$lib/stores/full-screen';
import Icon, { X, ArrowsExpand } from 'svelte-hero-icons';
import { page } from '$app/stores';

export let execution: DescribeWorkflowExecutionResponse;

$: name = execution.workflowExecutionInfo.type.name;
$: workflowId = execution.workflowExecutionInfo.execution.workflowId;
$: runId = execution.workflowExecutionInfo.execution.runId;
$: workflowUrl = `/workflows/${workflowId}/${runId}`;
$: workflowUrl = `/workflows/${workflowId}/${runId}?${new URLSearchParams({
fullScreen: !$isFullScreen,
})}`;
</script>

<section
Expand All @@ -39,7 +42,7 @@
<header
class="border-b-2 border-gray-200 px-6 pb-6 flex flex-col justify-between"
>
<a href={workflowUrl} on:click|preventDefault={isFullScreen.toggle}>
<a href={workflowUrl}>
<Icon
src={ArrowsExpand}
class="absolute right-10 top-2 w-8 h-8 text-gray-400"
Expand Down