fix(frontend): fix theme fork (#3380)

This commit is contained in:
Faton Ramadani
2024-03-08 14:37:42 +01:00
committed by GitHub
parent 58e0a8a4a8
commit f7e77a6fdf
2 changed files with 14 additions and 5 deletions

View File

@@ -144,6 +144,7 @@
on:reloadThemes={() => {
getThemes()
}}
on:setCodeTab
/>
{/key}
{/each}

View File

@@ -6,7 +6,7 @@
import Cell from '$lib/components/table/Cell.svelte'
import { Code, Eye, GitBranch, Pin, Save, Trash } from 'lucide-svelte'
import type { AppViewerContext } from '../../types'
import type { AppTheme, AppViewerContext } from '../../types'
import { sendUserToast } from '$lib/toast'
import Badge from '$lib/components/common/badge/Badge.svelte'
import { twMerge } from 'tailwind-merge'
@@ -103,13 +103,21 @@
$previewTheme = theme ?? ''
}
async function fork() {
async function fork(path: string) {
stopPreview()
const theme = await resolveTheme($app.theme, $workspaceStore)
const theme: AppTheme = {
type: 'path',
path: path ?? ''
}
const resolvedTheme = await resolveTheme(theme, $workspaceStore)
$app.theme = {
type: 'inlined',
css: theme
css: resolvedTheme
}
dispatch('setCodeTab')
}
@@ -177,7 +185,7 @@
View code
</div>
</MenuItem>
<MenuItem on:click={fork}>
<MenuItem on:click={() => fork(row.path)}>
<div
class={classNames(
'!text-primary flex flex-row items-center text-left px-4 py-2 gap-2 cursor-pointer hover:bg-gray-100 !text-xs font-semibold'