Skip to content

Open-source social media scheduler built for AI agents and the teams behind them. Create, schedule and publish posts to every network through MCP or the REST API, or write them yourself in a composer your team will love.

feat(ai): collapsible compact ContentStylePicker for tight panels

Paulo Castellano8ccd2878597f
diff --git a/resources/js/components/ai/ContentStylePicker.vue b/resources/js/components/ai/ContentStylePicker.vue
index bcb2d4973..258a3aa5e 100644
--- a/resources/js/components/ai/ContentStylePicker.vue
+++ b/resources/js/components/ai/ContentStylePicker.vue
@@ -1,5 +1,8 @@
<script setup lang="ts">
-import { IconCheck } from '@tabler/icons-vue';
+import { IconCheck, IconChevronDown } from '@tabler/icons-vue';
+import { computed, ref } from 'vue';
+
+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';
interface StyleOption {
key: string;
@@ -8,22 +11,32 @@ interface StyleOption {
description?: string;
}
-const props = defineProps<{
- modelValue: string;
- styles: StyleOption[];
-}>();
+const props = withDefaults(
+ defineProps<{
+ modelValue: string;
+ styles: StyleOption[];
+ mini?: boolean;
+ }>(),
+ { mini: false },
+);
const emit = defineEmits<{
'update:modelValue': [string];
}>();
+const open = ref(false);
+
+const selectedOption = computed(() => props.styles.find((style) => style.key === props.modelValue) ?? props.styles[0]);
+
const select = (key: string) => {
emit('update:modelValue', key);
+ open.value = false;
};
</script>
<template>
- <div class="grid gap-3 sm:grid-cols-3">
+ <!-- Full gallery: one card per style, side by side. -->
+ <div v-if="!props.mini" class="grid gap-3 sm:grid-cols-3">
<button
v-for="style in props.styles"
:key="style.key"
@@ -44,4 +57,42 @@ const select = (key: string) => {
</div>
</button>
</div>
+
+ <!-- Compact: collapsed to the selected style, expands into the list. -->
+ <Collapsible v-else v-model:open="open">
+ <CollapsibleTrigger as-child>
+ <button
+ type="button"
+ class="flex w-full cursor-pointer items-center gap-2.5 overflow-hidden rounded-xl border-2 border-foreground bg-card p-1.5 text-left transition-all hover:bg-foreground/5"
+ >
+ <div class="aspect-video w-28 shrink-0 overflow-hidden rounded-lg bg-muted">
+ <img :src="selectedOption.preview" :alt="selectedOption.name" class="size-full object-cover" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-bold text-foreground">{{ selectedOption.name }}</p>
+ <p v-if="selectedOption.description" class="mt-0.5 text-xs leading-snug text-foreground/60">{{ selectedOption.description }}</p>
+ </div>
+ <IconChevronDown class="mr-1 size-4 shrink-0 text-foreground/60 transition-transform" :class="open ? 'rotate-180' : ''" />
+ </button>
+ </CollapsibleTrigger>
+ <CollapsibleContent class="mt-2 space-y-2">
+ <button
+ v-for="style in props.styles"
+ :key="style.key"
+ type="button"
+ class="flex w-full cursor-pointer items-center gap-2.5 overflow-hidden rounded-xl border-2 border-foreground bg-card p-1.5 text-left transition-all hover:bg-foreground/5"
+ :class="modelValue === style.key ? '!bg-violet-100 shadow-md' : ''"
+ @click="select(style.key)"
+ >
+ <div class="aspect-video w-28 shrink-0 overflow-hidden rounded-lg bg-muted">
+ <img :src="style.preview" :alt="style.name" class="size-full object-cover" />
+ </div>
+ <div class="min-w-0 flex-1">
+ <p class="text-sm font-bold text-foreground">{{ style.name }}</p>
+ <p v-if="style.description" class="mt-0.5 text-xs leading-snug text-foreground/60">{{ style.description }}</p>
+ </div>
+ <IconCheck v-if="modelValue === style.key" class="mr-1 size-4 shrink-0 text-foreground" stroke-width="3" />
+ </button>
+ </CollapsibleContent>
+ </Collapsible>
</template>
diff --git a/resources/js/components/automations/config/GenerateNodeConfig.vue b/resources/js/components/automations/config/GenerateNodeConfig.vue
index 1e3505bbb..e6912e264 100644
--- a/resources/js/components/automations/config/GenerateNodeConfig.vue
+++ b/resources/js/components/automations/config/GenerateNodeConfig.vue
@@ -305,7 +305,7 @@ const channels = computed<Channel[]>(() =>
<div class="space-y-2">
<Label class="text-sm font-bold">{{ $t('automations.config.generate.style') }}</Label>
- <ContentStylePicker v-model="local.style" :styles="contentStyles" />
+ <ContentStylePicker v-model="local.style" :styles="contentStyles" mini />
</div>
<div v-if="imageCountCap >= 1" class="space-y-2">