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.
PHP ai-agentsblueskyfacebookinstagramlaravellinkedinmastodonmcpmcp-serveropen-sourcerest-apiself-hostedsocial-mediasocial-media-managementsocial-media-schedulerthreadstiktokvuejsxyoutube
Show calendar posts as icon tiles on mobile (#398)
Paulo Castellanod2a236b403ee
diff --git a/resources/js/components/publish/CalendarPostChip.vue b/resources/js/components/publish/CalendarPostChip.vueindex a99734a93..c6a022185 100644--- a/resources/js/components/publish/CalendarPostChip.vue+++ b/resources/js/components/publish/CalendarPostChip.vue@@ -27,6 +27,7 @@ const props = withDefaults(post: CalendarPost;timezone: string;layout?: 'month' | 'week';+ compact?: boolean;}>(),{ layout: 'month' },);@@ -137,72 +138,84 @@ const scheduleMode = computed(() =>class="flex min-w-0 shrink-0 gap-1.5 rounded-lg border border-border-strong bg-card text-start transition-control hover:bg-secondary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-ring data-[state=open]:bg-secondary":class="[STATUS_CLASSES[post.status] ?? '',- layout === 'week'- ? 'items-start p-1.5'- : 'h-7 items-center px-1',+ compact+ ? 'size-7 items-center justify-center'+ : layout === 'week'+ ? 'items-start p-1.5'+ : 'h-7 items-center px-1',]":aria-label="`${channels} · ${time} · ${text || $t('calendar.no_content')}`":data-testid="`calendar-post-${post.id}`">- <span class="flex min-w-0 flex-1 flex-col gap-1">- <span class="flex min-w-0 items-center gap-1">- <PlatformBrandIcon- v-if="post.platform"- :platform="post.platform"- class="size-4 shrink-0"- />+ <template v-if="compact">+ <PlatformBrandIcon+ v-if="post.platform"+ :platform="post.platform"+ colored+ class="size-4 shrink-0"+ />+ </template>+ <template v-else>+ <span class="flex min-w-0 flex-1 flex-col gap-1">+ <span class="flex min-w-0 items-center gap-1">+ <PlatformBrandIcon+ v-if="post.platform"+ :platform="post.platform"+ class="size-4 shrink-0"+ />+ <span+ class="truncate text-xs font-medium text-muted-foreground"+ >{{ time }}</span+ >+ <IconRepeat+ v-if="scheduleMode && post.recurrence_frequency"+ class="size-3 shrink-0 text-muted-foreground"+ :aria-label="$t('posts.recurrence.marker')"+ :data-testid="`calendar-post-recurring-${post.id}`"+ />+ <PostScheduleModeBadge+ v-else-if="scheduleMode"+ :post-id="post.id"+ :mode="scheduleMode"+ compact+ plain+ />+ </span><span- class="truncate text-xs font-medium text-muted-foreground"- >{{ time }}</span+ v-if="layout === 'week'"+ class="line-clamp-2 text-xs break-words text-foreground"+ :class="{ 'text-muted-foreground': !text }"+ :data-testid="`calendar-post-text-${post.id}`"+ >{{ text || $t('calendar.no_content') }}</span>- <IconRepeat- v-if="scheduleMode && post.recurrence_frequency"- class="size-3 shrink-0 text-muted-foreground"- :aria-label="$t('posts.recurrence.marker')"- :data-testid="`calendar-post-recurring-${post.id}`"- />- <PostScheduleModeBadge- v-else-if="scheduleMode"- :post-id="post.id"- :mode="scheduleMode"- compact- plain- /></span><span- v-if="layout === 'week'"- class="line-clamp-2 text-xs break-words text-foreground"- :class="{ 'text-muted-foreground': !text }"- :data-testid="`calendar-post-text-${post.id}`"- >{{ text || $t('calendar.no_content') }}</span+ v-if="thumbnail"+ class="relative shrink-0 overflow-hidden rounded bg-secondary"+ :class="layout === 'week' ? 'size-9' : 'size-5'">- </span>- <span- v-if="thumbnail"- class="relative shrink-0 overflow-hidden rounded bg-secondary"- :class="layout === 'week' ? 'size-9' : 'size-5'"- >- <img- v-if="isImage(thumbnail)"- :src="thumbnail.url"- alt=""- loading="lazy"- class="size-full object-cover"- />- <template v-else>- <video- :src="videoFrameUrl(thumbnail)"+ <img+ v-if="isImage(thumbnail)"+ :src="thumbnail.url"+ alt=""+ loading="lazy"class="size-full object-cover"- muted- playsinline- preload="metadata"- />- <IconPlayerPlayFilled- aria-hidden="true"- class="absolute top-1/2 left-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-black/60 p-0.5 text-white"/>- </template>- </span>+ <template v-else>+ <video+ :src="videoFrameUrl(thumbnail)"+ class="size-full object-cover"+ muted+ playsinline+ preload="metadata"+ />+ <IconPlayerPlayFilled+ aria-hidden="true"+ class="absolute top-1/2 left-1/2 size-3.5 -translate-x-1/2 -translate-y-1/2 rounded-full bg-black/60 p-0.5 text-white"+ />+ </template>+ </span>+ </template></button></PopoverTrigger><PopoverContentdiff --git a/resources/js/components/publish/CalendarSlotChip.vue b/resources/js/components/publish/CalendarSlotChip.vueindex 84b367be1..b0d92998c 100644--- a/resources/js/components/publish/CalendarSlotChip.vue+++ b/resources/js/components/publish/CalendarSlotChip.vue@@ -16,6 +16,7 @@ const props = withDefaults(timezone: string;canCreatePost: boolean;layout?: 'chip' | 'agenda';+ compact?: boolean;}>(),{ layout: 'chip' },);@@ -80,7 +81,12 @@ const newPost = (): void => {v-else:is="canCreatePost ? 'button' : 'div'":type="canCreatePost ? 'button' : undefined"- class="group/slot flex h-7 w-full min-w-0 shrink-0 items-center gap-1.5 rounded-lg border border-dashed border-border-strong px-1.5 text-xs font-medium text-muted-foreground transition-control enabled:hover:bg-secondary enabled:hover:text-foreground enabled:focus-visible:bg-secondary enabled:focus-visible:text-foreground"+ class="group/slot flex shrink-0 items-center rounded-lg border border-dashed border-border-strong text-xs font-medium text-muted-foreground transition-control enabled:hover:bg-secondary enabled:hover:text-foreground enabled:focus-visible:bg-secondary enabled:focus-visible:text-foreground"+ :class="+ compact+ ? 'size-7 justify-center'+ : 'h-7 w-full min-w-0 gap-1.5 px-1.5'+ ":title="channel?.display_label":aria-label="channel@@ -97,22 +103,24 @@ const newPost = (): void => {<PlatformBrandIconv-if="channel":platform="channel.platform"- class="shrink-0"+ :class="compact ? 'size-3.5' : 'shrink-0'":data-testid="`calendar-posting-slot-icon-${testKey}`"/>- <span- :class="[- 'truncate',- canCreatePost- ? 'group-hover/slot:hidden group-focus-visible/slot:hidden'- : '',- ]"- >{{ time }}</span- >- <span- v-if="canCreatePost"- class="hidden truncate group-hover/slot:inline group-focus-visible/slot:inline"- >{{ $t('posts.publish.add_post_in_slot') }}</span- >+ <template v-if="!compact">+ <span+ :class="[+ 'truncate',+ canCreatePost+ ? 'group-hover/slot:hidden group-focus-visible/slot:hidden'+ : '',+ ]"+ >{{ time }}</span+ >+ <span+ v-if="canCreatePost"+ class="hidden truncate group-hover/slot:inline group-focus-visible/slot:inline"+ >{{ $t('posts.publish.add_post_in_slot') }}</span+ >+ </template></component></template>diff --git a/resources/js/components/publish/CalendarTimeGrid.vue b/resources/js/components/publish/CalendarTimeGrid.vueindex 33968882d..bd1c08e77 100644--- a/resources/js/components/publish/CalendarTimeGrid.vue+++ b/resources/js/components/publish/CalendarTimeGrid.vue@@ -71,6 +71,19 @@ const isStacked = (hour: number,): boolean => (column.byHour.get(hour)?.length ?? 0) > 1;+const iconOnly = computed(() => compact.value && props.days.length === 7);++const chipClass = (+ column: { byHour: Map<number, CalendarItem[]> },+ hour: number,+): string => {+ if (iconOnly.value) {+ return '';+ }++ return isStacked(column, hour) ? 'w-full shrink-0' : 'flex-1';+};+const visibleItems = (key: string,hour: number,@@ -201,11 +214,8 @@ watch(? 'month': 'week'"- :class="- isStacked(column, hour)- ? 'w-full shrink-0'- : 'flex-1'- "+ :compact="iconOnly"+ :class="chipClass(column, hour)"/><CalendarSlotChipv-else-if="item.slot"@@ -213,11 +223,8 @@ watch(:channel="channels[item.slot.channel_id] ?? null":timezone="timezone":can-create-post="canCreatePost"- :class="- isStacked(column, hour)- ? 'w-full shrink-0'- : 'flex-1'- "+ :compact="iconOnly"+ :class="chipClass(column, hour)"/></template><buttondiff --git a/resources/js/pages/posts/Calendar.vue b/resources/js/pages/posts/Calendar.vueindex e1d4c7c51..e291a4e90 100644--- a/resources/js/pages/posts/Calendar.vue+++ b/resources/js/pages/posts/Calendar.vue@@ -432,10 +432,14 @@ const toggleDay = (key: string): void => {: [...expandedDays.value, key];};+const isDayExpanded = (day: dayjs.Dayjs): boolean =>+ expandedDays.value.includes(dayKey(day));++const hiddenCount = (day: dayjs.Dayjs): number =>+ itemsFor(day).length - MONTH_CHIPS;+const visibleMonthItems = (day: dayjs.Dayjs): CalendarItem[] =>- expandedDays.value.includes(dayKey(day))- ? itemsFor(day)- : itemsFor(day).slice(0, MONTH_CHIPS);+ isDayExpanded(day) ? itemsFor(day) : itemsFor(day).slice(0, MONTH_CHIPS);const mobileTitle = computed(() => {if (props.view === 'month') {@@ -711,7 +715,7 @@ const goToDay = (key: string): void => {<divv-for="(week, weekIndex) in calendarWeeks":key="weekIndex"- class="grid min-h-24 flex-1 auto-rows-[minmax(0,1fr)] grid-cols-7 border-border-strong md:min-h-[208px]"+ class="grid min-h-40 flex-1 auto-rows-[minmax(0,1fr)] grid-cols-7 border-border-strong md:min-h-[208px]":class="{ 'border-t': weekIndex > 0 }"><div@@ -757,7 +761,7 @@ const goToDay = (key: string): void => {class="flex flex-col gap-1":class="{'absolute inset-0 overflow-y-auto overscroll-contain':- expandedDays.includes(dayKey(day)),+ isDayExpanded(day),}":data-testid="`calendar-items-${dayKey(day)}`">@@ -769,6 +773,7 @@ const goToDay = (key: string): void => {v-if="item.post":post="item.post":timezone="timezone"+ :compact="!isDesktop"/><CalendarSlotChipv-else-if="item.slot"@@ -780,45 +785,55 @@ const goToDay = (key: string): void => {":timezone="timezone":can-create-post="canCreatePost"+ :compact="!isDesktop"/></template></div></div><button- v-if="- itemsFor(day).length > MONTH_CHIPS- "- type="button"- class="inline-flex h-6 shrink-0 items-center gap-1 self-end rounded-md px-2 text-xs font-medium text-foreground transition-control hover:bg-accent"- :aria-expanded="- expandedDays.includes(dayKey(day))- "- :data-testid="`calendar-more-${dayKey(day)}`"- @click="toggleDay(dayKey(day))"- >- <IconChevronDown- class="size-3.5 transition-transform"- :class="{- 'rotate-180':- expandedDays.includes(- dayKey(day),+ v-if="hiddenCount(day) > 0"+ type="button"+ class="inline-flex shrink-0 items-center gap-1 rounded-md text-xs font-medium text-foreground transition-control hover:bg-accent"+ :class="+ isDesktop+ ? 'h-6 self-end px-2'+ : 'h-7 min-w-7 justify-center self-start px-1'+ "+ :aria-expanded="isDayExpanded(day)"+ :aria-label="+ isDesktop+ ? undefined+ : isDayExpanded(day)+ ? $t('calendar.less')+ : $t('calendar.more', {+ count: String(+ hiddenCount(day),),- }"- />- {{- expandedDays.includes(- dayKey(day),- )- ? $t('calendar.less')- : $t('calendar.more', {- count: String(- itemsFor(day)- .length -- MONTH_CHIPS,- ),- })- }}- </button>+ })+ "+ :data-testid="`calendar-more-${dayKey(day)}`"+ @click="toggleDay(dayKey(day))"+ >+ <IconChevronDown+ v-if="isDesktop || isDayExpanded(day)"+ class="size-3.5 transition-transform"+ :class="{+ 'rotate-180': isDayExpanded(day),+ }"+ />+ <template v-if="isDesktop">{{+ isDayExpanded(day)+ ? $t('calendar.less')+ : $t('calendar.more', {+ count: String(+ hiddenCount(day),+ ),+ })+ }}</template>+ <template v-else-if="!isDayExpanded(day)"+ >+{{ hiddenCount(day) }}</template+ >+ </button></div></div></div>diff --git a/tests/Browser/CalendarPageTest.php b/tests/Browser/CalendarPageTest.phpindex 49c346e3e..4cf4b38cf 100644--- a/tests/Browser/CalendarPageTest.php+++ b/tests/Browser/CalendarPageTest.php@@ -551,6 +551,7 @@ test('on a phone the week shows its seven days in columns with their posts', fun$page->assertPresent("@calendar-post-{$first->id}")->assertPresent("@calendar-post-{$second->id}")+ ->assertScript("(() => { const box = document.querySelector('[data-testid=\"calendar-post-{$first->id}\"]').getBoundingClientRect(); return box.width === box.height; })()", true)->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true)->assertNoJavaScriptErrors();});@@ -569,6 +570,7 @@ test('the three days view shows three columns, and only the phone picker offers->toBe(collect(range(0, 2))->map(fn (int $offset): string => "calendar-column-{$day->copy()->addDays($offset)->format('Y-m-d')}")->all());$page->assertPresent("@calendar-post-{$post->id}")+ ->assertSeeIn("@calendar-post-{$post->id}", '9:00')->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true);$page->resize(1280, 900);@@ -586,7 +588,7 @@ test('the three days view shows three columns, and only the phone picker offers$page->assertMissing("@calendar-post-{$post->id}")->assertNoJavaScriptErrors();});-test('on a phone the month shows its weeks in columns with the posts of each day', function () {+test('on a phone the month shows its weeks in columns with the posts of each day as icon tiles', function () {[$user, $linkedin, $x] = calendarPageSetup();$day = now('UTC')->addMonthNoOverflow()->startOfMonth()->addDays(12);$dayKey = $day->format('Y-m-d');@@ -599,9 +601,15 @@ test('on a phone the month shows its weeks in columns with the posts of each day$page->assertPresent("@calendar-day-{$dayKey}")->assertPresent("@calendar-post-{$posts[0]->id}")- ->assertPresent("@calendar-more-{$dayKey}")+ ->assertSeeIn("@calendar-more-{$dayKey}", '+2')+ ->assertDontSeeIn("@calendar-more-{$dayKey}", __('calendar.more', ['count' => 2]))+ ->assertScript("(() => { const chip = document.querySelector('[data-testid=\"calendar-post-{$posts[0]->id}\"]'); const box = chip.getBoundingClientRect(); return box.width === box.height && chip.innerText.trim() === '' && !chip.querySelector('img, video'); })()", true)->assertScript('document.documentElement.scrollWidth <= window.innerWidth', true)->assertNoJavaScriptErrors();++ $page->click("@calendar-more-{$dayKey}");+ waitForCalendarTestId($page, "calendar-post-{$posts[4]->id}");+ $page->assertAttribute("@calendar-more-{$dayKey}", 'aria-label', __('calendar.less'));});test('on a phone, tapping a post in the month opens its details directly', function () {