fix: improve quickstyle to be in static ccomponents only

This commit is contained in:
Ruben Fiszel
2023-11-30 21:09:27 +01:00
parent 056d03b386
commit 205339b3b6
4 changed files with 19 additions and 12 deletions
+1
View File
@@ -1245,6 +1245,7 @@ pub async fn run_worker<R: rsmq_async::RsmqConnection + Send + Sync + Clone + 's
if (jobs_executed as u32 + vacuum_shift) % VACUUM_PERIOD == 0 {
if let Err(e) = sqlx::query!("VACUUM queue").execute(db).await {
jobs_executed += 1;
tracing::error!(worker = %worker_name, "failed to vacuum queue: {}", e);
}
tracing::info!(worker = %worker_name, "vacuumed queue and completed_job");
@@ -247,10 +247,12 @@ export function getRecommendedDimensionsByComponent(
return { w: +size[0], h: +size[1] }
}
export type Quickstyle = { quickCss?: string[]; quickTailwindClasses?: string[] }
export type AppComponentConfig<T extends TypedComponent['type']> = {
name: string
icon: any
documentationLink: string
quickstyle?: Record<string, Quickstyle>
/**
* Dimensions key formula:
* [**mobile width**]:[**mobile height**]-[**desktop width**]:[**desktop height**]
@@ -2727,19 +2729,25 @@ This is a paragraph.
icon: FileBarChart,
documentationLink: `${documentationBaseUrl}/statistic_card`,
dims: '2:4-3:4' as AppComponentDimensions,
quickstyle: {
title: {
quickCss: ['font-size: 1rem', 'font-size: 1.5rem', 'font-size: 2rem'],
quickTailwindClasses: ['text-xs', 'text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl']
},
value: {
quickCss: ['font-size: 1rem', 'font-size: 1.5rem', 'font-size: 2rem'],
quickTailwindClasses: ['text-xs', 'text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl']
}
} as Record<string, Quickstyle>,
customCss: {
title: {
class: '',
style: '',
quickCss: ['font-size: 1rem', 'font-size: 1.5rem', 'font-size: 2rem'],
quickTailwindClasses: ['text-xs', 'text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl']
style: ''
},
container: { class: '', style: '' },
value: {
class: '',
style: '',
quickCss: ['font-size: 1rem', 'font-size: 1.5rem', 'font-size: 2rem'],
quickTailwindClasses: ['text-xs', 'text-sm', 'text-base', 'text-lg', 'text-xl', 'text-2xl']
style: ''
},
media: { class: '', style: '' }
},
@@ -167,9 +167,9 @@
/>
</div>
{/if}
{#if value.quickCss}
{#if componentType && ccomponents?.[componentType]?.quickstyle?.[name]?.quickCss}
<div class="flex flex-row gap-1 items-center mt-1 flex-wrap">
{#each value.quickCss as v}
{#each ccomponents?.[componentType]?.quickstyle?.[name].quickCss ?? [] as v}
<Badge
small
baseClass="cursor-pointer"
@@ -206,9 +206,9 @@
subType="tailwind"
/>
</div>
{#if value.quickTailwindClasses}
{#if componentType && ccomponents?.[componentType]?.quickstyle?.[name]?.quickTailwindClasses}
<div class="flex flex-row gap-1 items-center mt-1 flex-wrap">
{#each value.quickTailwindClasses as cls}
{#each ccomponents?.[componentType]?.quickstyle?.[name]?.quickTailwindClasses ?? [] as cls}
<Badge
baseClass="cursor-pointer"
small
@@ -44,8 +44,6 @@ export type ComponentCssProperty = {
class?: string
style?: string
evalClass?: RichConfiguration
quickCss?: readonly string[] | undefined
quickTailwindClasses?: readonly string[] | undefined
}
export type ComponentCustomCSS<T extends keyof typeof components> = Partial<