Social Media Post Scheduler
blockmarketingMulti-platform social media composer and post scheduler. Features channel toggles, rich text composer with emoji & hashtag insertion, character counter, media upload preview, scheduled time picker with best-time recommendations, auto-repost toggle, and high-fidelity live social feed previews for X (Twitter), LinkedIn, Instagram, and Threads.
Installation
$pnpm dlx uipkge-ng@latest add social-media-post-scheduler$npx uipkge-ng@latest add social-media-post-scheduler$yarn dlx uipkge-ng@latest add social-media-post-scheduler$bunx uipkge-ng@latest add social-media-post-schedulerManifest:
https://uipkge.dev/r/angular/social-media-post-scheduler.jsonInstalls to:src/app/components/blocks/social-media-post-scheduler/Variants
Loading interactive previews…
Loading interactive previews…
Files installed (2)
src/app/components/blocks/social-media-post-scheduler/social-media-post-scheduler.component.ts55.2 kB
// Multi-platform social media composer and post scheduler. Features channel toggles, // rich text composer with emoji & hashtag insertion, character counter, media upload // preview, scheduled time picker with best-time recommendations, auto-repost toggle, // and high-fidelity live social feed previews for X (Twitter), LinkedIn, Instagram, // and Threads. Port of the Vue/React block 1:1. import { ChangeDetectionStrategy, Component, Input, computed, signal } from '@angular/core' import { Bookmark, Calendar, Check, CheckCircle2, Clock, Eye, Globe, Heart, Image as ImageIcon, LucideAngularModule, MessageCircle, MessageSquare, MoreHorizontal, Repeat2, Send, Share2, Sparkles, ThumbsUp, Trash2, UploadCloud, X, } from 'lucide-angular' import { cn } from '@/lib/utils' import { UiAvatarComponent, UiAvatarFallbackComponent, UiAvatarImageComponent } from '@/ui/avatar/avatar.component' import { UiBadgeComponent } from '@/ui/badge/badge.component' import { UiButtonComponent } from '@/ui/button/button.component' import { UiCardComponent, UiCardContentComponent, UiCardDescriptionComponent, UiCardFooterComponent, UiCardHeaderComponent, UiCardTitleComponent, } from '@/ui/card/card.component' import { UiInputComponent } from '@/ui/input/input.component' import { UiSeparatorComponent } from '@/ui/separator/separator.component' import { UiSwitchComponent } from '@/ui/switch/switch.component' import { UiTabsComponent, UiTabsContentComponent, UiTabsListComponent, UiTabsTriggerComponent, } from '@/ui/tabs/tabs.component' import { UiTextareaComponent } from '@/ui/textarea/textarea.component' const defaultContent = 'Excited to announce the new component release for our open source design system! 🚀 Built with accessible keyboard ergonomics, fluid motion, and crisp token hierarchy out of the box.\n\n#UI #Developer #OpenSource' const author = { name: 'Alex Morgan', role: 'Staff Product Engineer', headline: 'Staff Product Engineer · Building open-source UI design systems & web tools', twitterHandle: '@alexmorgan_dev', instagramHandle: 'alexmorgan.dev', threadsHandle: 'alexmorgan', avatar: 'https://images.unsplash.com/photo-1534528741775-53994a69daeb?q=80&w=256&auto=format&fit=crop', initials: 'AM', } const sampleImages = [ { id: 'dashboard', label: 'Dashboard Preview', url: 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?q=80&w=1200&auto=format&fit=crop', dimensions: '1200 × 675 px · 284 KB', aspect: '16:9 Landscape', }, { id: 'workspace', label: 'Dev Workspace', url: 'https://images.unsplash.com/photo-1498050108023-c5249f4df085?q=80&w=1200&auto=format&fit=crop', dimensions: '1200 × 800 px · 340 KB', aspect: '3:2 Photo', }, { id: 'design', label: 'Design Canvas', url: 'https://images.unsplash.com/photo-1507238691740-187a5b1d37b8?q=80&w=1200&auto=format&fit=crop', dimensions: '1080 × 1080 px · 410 KB', aspect: '1:1 Square', }, ] const suggestedHashtags = [ '#UI', '#Developer', '#OpenSource', '#DesignSystem', '#WebDev', '#Frontend', '#Tech', '#SaaS', ] const quickEmojis = ['🚀', '✨', '💡', '🔥', '📊', '🧵', '🎉', '⚡', '👇', '🎯'] const timeSlots = ['09:00 AM EST', '10:00 AM EST', '01:30 PM EST', '05:00 PM EST'] const platformLimits: Record<string, { name: string; limit: number }> = { twitter: { name: 'X (Twitter)', limit: 280 }, threads: { name: 'Threads', limit: 500 }, instagram: { name: 'Instagram', limit: 2200 }, linkedin: { name: 'LinkedIn', limit: 3000 }, } @Component({ changeDetection: ChangeDetectionStrategy.Eager, selector: 'ui-social-media-post-scheduler, [ui-social-media-post-scheduler]', standalone: true, host: { '[attr.class]': '"contents"' }, imports: [ LucideAngularModule, UiAvatarComponent, UiAvatarFallbackComponent, UiAvatarImageComponent, UiBadgeComponent, UiButtonComponent, UiCardComponent, UiCardContentComponent, UiCardDescriptionComponent, UiCardFooterComponent, UiCardHeaderComponent, UiCardTitleComponent, UiInputComponent, UiSeparatorComponent, UiSwitchComponent, UiTabsComponent, UiTabsContentComponent, UiTabsListComponent, UiTabsTriggerComponent, UiTextareaComponent, ], template: ` <div data-slot="social-media-post-scheduler" class="bg-background text-foreground flex w-full flex-col gap-6"> <!-- Top Global Header --> <header class="bg-card border-border flex flex-col gap-4 rounded-xl border p-5 shadow-xs sm:flex-row sm:items-center sm:justify-between" > <div class="space-y-1"> <div class="flex flex-wrap items-center gap-2.5"> <div class="bg-primary/10 text-primary flex size-8 items-center justify-center rounded-lg"> <lucide-icon [img]="Calendar" class="size-4" /> </div> <h1 class="text-foreground text-lg font-semibold tracking-tight">Social Post Composer & Scheduler</h1> <span ui-badge variant="secondary" class="font-mono text-xs"> {{ selectedChannels().length }} / 4 Networks </span> </div> <p class="text-muted-foreground text-sm"> Compose, calibrate, and orchestrate cross-platform social broadcasts with live authentic previews. </p> </div> <div class="flex flex-wrap items-center gap-2.5"> <button ui-button variant="outline" size="sm" (click)="saveDraft()"> <lucide-icon [img]="Bookmark" class="mr-1.5 size-3.5" /> Save Draft </button> <button ui-button size="sm" (click)="schedulePost()"> <lucide-icon [img]="Calendar" class="mr-1.5 size-3.5" /> Schedule Post </button> </div> </header> <!-- Feedback Notification Toast Banner --> @if (notificationMessage(); as msg) { <div [class]="notificationClass"> <div class="flex flex-wrap items-center gap-2.5"> @if (notificationType() === 'success') { <lucide-icon [img]="CheckCircle2" class="size-4 shrink-0" /> } @else { <lucide-icon [img]="Bookmark" class="size-4 shrink-0" /> } <span>{{ msg }}</span> </div> <button type="button" aria-label="Dismiss notification" class="text-muted-foreground hover:text-foreground focus-visible:ring-ring rounded p-1 focus-visible:ring-2 focus-visible:outline-none" (click)="dismissNotification()" > <lucide-icon [img]="X" class="size-4" /> </button> </div> } <!-- 2-Column Composer & Live Preview Grid --> <div class="grid grid-cols-1 gap-6 lg:grid-cols-12"> <!-- Left Column: Composer, Channels, Media, Schedule Settings --> <section class="space-y-6 lg:col-span-6"> <!-- Target Channels Selection Card --> <div ui-card> <div ui-card-header class="pb-3"> <div class="flex items-center justify-between"> <h3 ui-card-title class="text-base font-semibold">Publishing Channels</h3> <span class="text-muted-foreground text-xs font-medium">Select all target feeds</span> </div> <p ui-card-description class="text-xs">Toggle the target social accounts for this scheduled broadcast.</p> </div> <div ui-card-content> <div class="grid grid-cols-2 gap-2.5 sm:grid-cols-4"> <button type="button" [class]="channelClass('twitter', 'border-primary bg-primary/5 ring-primary ring-1')" (click)="toggleChannel('twitter')" > <div class="flex w-full items-center justify-between"> <div class="bg-foreground text-background flex size-6 items-center justify-center rounded-md"> <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 24.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" /> </svg> </div> <div [class]="checkClass('twitter', 'bg-primary text-primary-foreground')"> @if (isChannelSelected('twitter')) { <lucide-icon [img]="Check" class="size-2.5 stroke-[3]" /> } </div> </div> <div> <div class="text-xs font-semibold">X / Twitter</div> <div class="text-muted-foreground text-xs">280 chars</div> </div> </button> <button type="button" [class]="channelClass('linkedin', 'border-info bg-info/5 ring-1 ring-blue-600')" (click)="toggleChannel('linkedin')" > <div class="flex w-full items-center justify-between"> <div class="flex size-6 items-center justify-center rounded-md bg-[#0077B5] text-white"> <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.28 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93h2.75M6.46 8.76a1.45 1.45 0 1 0 0-2.9 1.45 1.45 0 0 0 0 2.9m1.4 9.74v-8.37H5.06v8.37z" /> </svg> </div> <div [class]="checkClass('linkedin', 'bg-info text-white')"> @if (isChannelSelected('linkedin')) { <lucide-icon [img]="Check" class="size-2.5 stroke-[3]" /> } </div> </div> <div> <div class="text-xs font-semibold">LinkedIn</div> <div class="text-muted-foreground text-xs">3,000 chars</div> </div> </button> <button type="button" [class]="channelClass('instagram', 'border-pink-500 bg-pink-500/5 ring-1 ring-pink-500')" (click)="toggleChannel('instagram')" > <div class="flex w-full items-center justify-between"> <div class="flex size-6 items-center justify-center rounded-md bg-gradient-to-tr from-[#f09433] via-[#dc2743] to-[#bc1888] text-white" > <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z" /> </svg> </div> <div [class]="checkClass('instagram', 'bg-pink-500 text-white')"> @if (isChannelSelected('instagram')) { <lucide-icon [img]="Check" class="size-2.5 stroke-[3]" /> } </div> </div> <div> <div class="text-xs font-semibold">Instagram</div> <div class="text-muted-foreground text-xs">2,200 chars</div> </div> </button> <button type="button" [class]="channelClass('threads', 'border-foreground bg-foreground/5 ring-foreground ring-1')" (click)="toggleChannel('threads')" > <div class="flex w-full items-center justify-between"> <div class="bg-foreground text-background flex size-6 items-center justify-center rounded-md"> <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M12.186 24C5.454 24 0 18.618 0 12.016 0 5.414 5.454.032 12.186.032c6.64 0 11.966 5.228 12.004 11.758a12.08 12.08 0 0 1-3.69 8.643 11.85 11.85 0 0 1-8.314 3.567zm0-2.352a9.66 9.66 0 0 0 6.84-2.88 9.77 9.77 0 0 0 2.83-6.978c-.03-5.263-4.3-9.458-9.67-9.458-5.438 0-9.845 4.343-9.845 9.684 0 5.342 4.407 9.632 9.845 9.632z" /> </svg> </div> <div [class]="checkClass('threads', 'bg-foreground text-background')"> @if (isChannelSelected('threads')) { <lucide-icon [img]="Check" class="size-2.5 stroke-[3]" /> } </div> </div> <div> <div class="text-xs font-semibold">Threads</div> <div class="text-muted-foreground text-xs">500 chars</div> </div> </button> </div> </div> </div> <!-- Post Content Composer Card --> <div ui-card> <div ui-card-header class="pb-3"> <div class="flex items-center justify-between"> <h3 ui-card-title class="text-base font-semibold">Post Content</h3> <button ui-button variant="ghost" size="xs" class="text-primary hover:text-primary gap-1" (click)="polishWithAi()" > <lucide-icon [img]="Sparkles" class="size-3.5" /> <span>AI Polish</span> </button> </div> </div> <div ui-card-content class="space-y-4"> <div class="space-y-2"> <ui-textarea [value]="content()" (valueChange)="content.set($event)" [rows]="6" placeholder="What would you like to share? Write once, preview across all social platforms..." class="min-h-[140px] text-sm" /> <div class="flex flex-wrap items-center justify-between gap-2 pt-1"> <div class="flex flex-wrap items-center gap-1"> @for (emoji of emojis; track emoji) { <button type="button" class="hover:bg-muted text-muted-foreground hover:text-foreground focus-visible:ring-ring flex size-7 items-center justify-center rounded text-sm transition-colors focus-visible:ring-1 focus-visible:outline-none" (click)="insertEmoji(emoji)" > {{ emoji }} </button> } </div> <div class="flex items-center gap-2"> <span ui-badge [variant]="counterVariant()" class="font-mono text-xs"> {{ currentLength() }} / {{ currentPlatformLimit() }} </span> </div> </div> </div> <div class="space-y-1.5 pt-1"> <span class="text-muted-foreground text-xs font-medium">Recommended Hashtags</span> <div class="flex flex-wrap gap-1.5"> @for (tag of hashtags; track tag) { <button type="button" [class]="hashtagClass(tag)" (click)="insertHashtag(tag)"> {{ tag }} </button> } </div> </div> </div> </div> <!-- Media Attachment Dropzone Card --> <div ui-card> <div ui-card-header class="pb-3"> <div class="flex items-center justify-between"> <h3 ui-card-title class="text-base font-semibold">Media Attachment</h3> @if (mediaUrl()) { <span ui-badge variant="success" class="text-xs">Attached</span> } @else { <span ui-badge variant="outline" class="text-xs">Optional</span> } </div> </div> <div ui-card-content class="space-y-3"> @if (mediaUrl(); as url) { <div class="border-border bg-muted/20 relative flex flex-col gap-3 rounded-lg border p-3 sm:flex-row sm:items-center sm:justify-between" > <div class="flex items-center gap-3"> <div class="border-border relative size-16 shrink-0 overflow-hidden rounded-md border"> <img [src]="url" alt="Post attachment preview" class="size-full object-cover" /> </div> <div class="space-y-1"> <div class="text-foreground text-xs font-semibold">product-launch-graphic.png</div> <div class="text-muted-foreground text-xs">1200 × 675 px · 284 KB</div> <span ui-badge variant="secondary" class="text-xs">16:9 Aspect</span> </div> </div> <div class="flex items-center gap-2"> <button ui-button variant="ghost" size="sm" class="text-destructive hover:text-destructive hover:bg-destructive/10" (click)="removeMedia()" > <lucide-icon [img]="Trash2" class="mr-1.5 size-3.5" /> Remove </button> </div> </div> } @else { <div class="border-border hover:border-primary/50 flex flex-col items-center justify-center rounded-lg border border-dashed p-6 text-center transition-colors" > <div class="bg-muted text-muted-foreground flex size-10 items-center justify-center rounded-full"> <lucide-icon [img]="UploadCloud" class="size-5" /> </div> <p class="text-foreground mt-2 text-xs font-semibold">Drag & drop media attachment</p> <p class="text-muted-foreground text-xs">PNG, JPG, GIF or MP4 up to 25MB</p> </div> } <div class="space-y-1.5 pt-1"> <span class="text-muted-foreground text-xs font-medium">Quick Sample Media:</span> <div class="flex flex-wrap gap-2"> @for (sample of samples; track sample.id) { <button type="button" [class]="sampleClass(sample.url)" (click)="setPresetImage(sample.url)"> {{ sample.label }} </button> } </div> </div> </div> </div> <!-- Schedule Configuration Card --> <div ui-card> <div ui-card-header class="pb-3"> <h3 ui-card-title class="text-base font-semibold">Schedule Settings</h3> <p ui-card-description class="text-xs">Determine publish timing and automated amplification rules.</p> </div> <div ui-card-content class="space-y-4"> <div class="grid grid-cols-1 gap-3 sm:grid-cols-2"> <div class="space-y-1.5"> <label class="text-foreground text-xs font-medium">Publish Date</label> <ui-input [value]="scheduledDate()" (valueChange)="scheduledDate.set($event)" type="date" class="text-xs" /> </div> <div class="space-y-1.5"> <label class="text-foreground text-xs font-medium">Publish Time</label> <ui-input [value]="scheduledTime()" (valueChange)="scheduledTime.set($event)" placeholder="10:00 AM EST" class="text-xs" /> </div> </div> <div class="bg-primary/5 border-primary/20 flex items-start gap-2.5 rounded-lg border p-3 text-xs"> <lucide-icon [img]="Clock" class="text-primary mt-0.5 size-4 shrink-0" /> <div class="space-y-1"> <span class="text-foreground font-semibold">Optimal window: 10:00 AM EST</span> <p class="text-muted-foreground leading-relaxed"> Based on your audience timezone, posting between 09:30 AM – 10:30 AM EST generates +34% higher average CTR. </p> <div class="flex flex-wrap gap-1.5 pt-1"> @for (slot of slots; track slot) { <button type="button" [class]="slotClass(slot)" (click)="scheduledTime.set(slot)"> {{ slot }} </button> } </div> </div> </div> <ui-separator /> <div class="space-y-3"> <div class="flex items-center justify-between gap-2"> <div class="space-y-0.5"> <span class="text-foreground text-xs font-medium">Auto-repost evergreen content</span> <p class="text-muted-foreground text-xs"> Reshuffle and repost to X & Threads after 24h if initial engagement crosses 100 interactions. </p> </div> <ui-switch [checked]="autoRepost()" (checkedChange)="autoRepost.set($event)" aria-label="Auto-repost evergreen content" /> </div> <div class="flex items-center justify-between gap-2"> <div class="space-y-0.5"> <span class="text-foreground text-xs font-medium">Auto-append first comment / thread link</span> <p class="text-muted-foreground text-xs"> Places outbound GitHub & documentation links in the first comment to avoid algorithm penalty. </p> </div> <ui-switch [checked]="firstCommentThread()" (checkedChange)="firstCommentThread.set($event)" aria-label="Auto-append first comment" /> </div> </div> </div> </div> </section> <!-- Right Column: Live Social Feed Preview --> <section class="space-y-4 lg:col-span-6"> <div ui-card class="flex h-full flex-col"> <div ui-card-header class="pb-3"> <div class="flex items-center justify-between"> <div class="flex items-center gap-2"> <h3 ui-card-title class="text-base font-semibold">Live Social Feed Preview</h3> <span ui-badge variant="outline" class="border-success/30 bg-success/10 text-success gap-1 text-xs"> <span class="bg-success size-1.5 animate-pulse rounded-full"></span> Live Sync </span> </div> <span class="text-muted-foreground font-mono text-xs"> Scheduled: {{ scheduledDate() }} · {{ scheduledTime() }} </span> </div> <p ui-card-description class="text-xs"> Preview pixel-accurate mockups in authentic platform containers. </p> </div> <div ui-card-content class="flex flex-1 flex-col space-y-4"> <ui-tabs [value]="activeTab()" (valueChange)="activeTab.set($event)" class="w-full"> <ui-tabs-list class="grid w-full grid-cols-4"> <button ui-tabs-trigger value="twitter" class="gap-1.5 text-xs"> <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 24.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" /> </svg> <span>X / Twitter</span> </button> <button ui-tabs-trigger value="linkedin" class="gap-1.5 text-xs"> <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3a3.26 3.26 0 0 0-3.26-3.26c-.85 0-1.84.52-2.28 1.3v-1.11h-2.79v8.37h2.79v-4.93c0-.77.62-1.4 1.39-1.4a1.4 1.4 0 0 1 1.4 1.4v4.93h2.75M6.46 8.76a1.45 1.45 0 1 0 0-2.9 1.45 1.45 0 0 0 0 2.9m1.4 9.74v-8.37H5.06v8.37z" /> </svg> <span>LinkedIn</span> </button> <button ui-tabs-trigger value="instagram" class="gap-1.5 text-xs"> <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z" /> </svg> <span>Instagram</span> </button> <button ui-tabs-trigger value="threads" class="gap-1.5 text-xs"> <svg class="size-3.5" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"> <path d="M12.186 24C5.454 24 0 18.618 0 12.016 0 5.414 5.454.032 12.186.032c6.64 0 11.966 5.228 12.004 11.758a12.08 12.08 0 0 1-3.69 8.643 11.85 11.85 0 0 1-8.314 3.567zm0-2.352a9.66 9.66 0 0 0 6.84-2.88 9.77 9.77 0 0 0 2.83-6.978c-.03-5.263-4.3-9.458-9.67-9.458-5.438 0-9.845 4.343-9.845 9.684 0 5.342 4.407 9.632 9.845 9.632z" /> </svg> <span>Threads</span> </button> </ui-tabs-list> <ui-tabs-content value="twitter" class="mt-4"> <div class="border-border bg-card rounded-xl border p-4 shadow-xs"> <div class="flex items-start gap-3"> <ui-avatar class="size-10"> <ui-avatar-image [src]="profile.avatar" [alt]="profile.name" /> <ui-avatar-fallback>{{ profile.initials }}</ui-avatar-fallback> </ui-avatar> <div class="flex-1 space-y-2"> <div class="flex items-center justify-between"> <div class="flex flex-wrap items-center gap-1.5"> <span class="text-foreground text-sm font-bold">{{ profile.name }}</span> <svg class="fill-info text-info size-4 shrink-0" viewBox="0 0 24 24"> <path fill-rule="evenodd" clip-rule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.004 6.308a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" /> </svg> <span class="text-muted-foreground text-xs">{{ profile.twitterHandle }}</span> <span class="text-muted-foreground text-xs">· Scheduled</span> </div> <lucide-icon [img]="MoreHorizontal" class="text-muted-foreground size-4" /> </div> <div class="text-foreground text-sm leading-relaxed whitespace-pre-wrap"> @for (seg of segments(); track $index) { @if (seg.isHashtag) { <span class="text-info cursor-pointer font-normal hover:underline">{{ seg.text }}</span> } @else { <span>{{ seg.text }}</span> } } @if (!content()) { <span class="text-muted-foreground italic">Post body is empty...</span> } </div> @if (mediaUrl(); as url) { <div class="border-border mt-3 overflow-hidden rounded-2xl border"> <img [src]="url" alt="Post preview image" class="max-h-72 w-full object-cover" /> </div> } <div class="text-muted-foreground flex items-center gap-1.5 pt-1 text-xs"> <lucide-icon [img]="Clock" class="size-3" /> <span>Will publish on {{ scheduledDate() }} at {{ scheduledTime() }}</span> </div> <ui-separator class="my-2" /> <div class="text-muted-foreground flex items-center justify-between text-xs"> <button type="button" class="hover:text-info flex min-h-6 items-center gap-1.5 transition-colors" > <lucide-icon [img]="MessageCircle" class="size-4" /> <span>24</span> </button> <button type="button" class="hover:text-success flex min-h-6 items-center gap-1.5 transition-colors" > <lucide-icon [img]="Repeat2" class="size-4" /> <span>12</span> </button> <button type="button" class="hover:text-destructive flex min-h-6 items-center gap-1.5 transition-colors" [class.text-destructive]="isLikedInPreview()" (click)="toggleLike()" > <lucide-icon [img]="Heart" class="size-4" [class.fill-destructive]="isLikedInPreview()" /> <span>{{ isLikedInPreview() ? 159 : 158 }}</span> </button> <button type="button" class="hover:text-info flex min-h-6 items-center gap-1.5 transition-colors" > <lucide-icon [img]="Eye" class="size-4" /> <span>4.2K</span> </button> <div class="flex items-center gap-2"> <lucide-icon [img]="Bookmark" class="hover:text-foreground size-4 cursor-pointer" /> <lucide-icon [img]="Share2" class="hover:text-foreground size-4 cursor-pointer" /> </div> </div> </div> </div> </div> </ui-tabs-content> <ui-tabs-content value="linkedin" class="mt-4"> <div class="border-border bg-card rounded-xl border p-4 shadow-xs"> <div class="flex items-start justify-between"> <div class="flex items-start gap-3"> <ui-avatar class="size-11"> <ui-avatar-image [src]="profile.avatar" [alt]="profile.name" /> <ui-avatar-fallback>{{ profile.initials }}</ui-avatar-fallback> </ui-avatar> <div class="space-y-0.5"> <div class="flex items-center gap-1.5"> <span class="text-foreground text-sm font-semibold">{{ profile.name }}</span> <span class="text-muted-foreground text-xs">• 1st</span> </div> <p class="text-muted-foreground line-clamp-1 text-xs">{{ profile.headline }}</p> <div class="text-muted-foreground flex items-center gap-1 text-xs"> <span>Scheduled ({{ scheduledDate() }})</span> <span>•</span> <lucide-icon [img]="Globe" class="size-3" /> </div> </div> </div> <lucide-icon [img]="MoreHorizontal" class="text-muted-foreground size-4" /> </div> <div class="text-foreground mt-3 text-sm leading-relaxed whitespace-pre-wrap"> @for (seg of segments(); track $index) { @if (seg.isHashtag) { <span class="text-info cursor-pointer font-medium hover:underline">{{ seg.text }}</span> } @else { <span>{{ seg.text }}</span> } } @if (!content()) { <span class="text-muted-foreground italic">Post body is empty...</span> } </div> @if (mediaUrl(); as url) { <div class="border-border mt-3 overflow-hidden rounded-lg border"> <img [src]="url" alt="Post preview image" class="max-h-72 w-full object-cover" /> </div> } <div class="text-muted-foreground flex items-center justify-between pt-3 text-xs"> <div class="flex items-center gap-1.5"> <div class="flex -space-x-1"> <span class="bg-info flex size-4 items-center justify-center rounded-full text-xs text-white" >👍</span > <span class="bg-destructive flex size-4 items-center justify-center rounded-full text-xs text-white" >❤️</span > <span class="bg-warning flex size-4 items-center justify-center rounded-full text-xs text-white" >💡</span > </div> <span class="font-medium">89</span> </div> <span>14 comments · 6 reposts</span> </div> <ui-separator class="my-2" /> <div class="text-muted-foreground grid grid-cols-4 gap-1 text-center text-xs font-medium"> <button type="button" class="hover:bg-muted hover:text-foreground flex items-center justify-center gap-1.5 rounded-md py-2 transition-colors" [class.text-info]="isLikedInPreview()" [class.font-semibold]="isLikedInPreview()" (click)="toggleLike()" > <lucide-icon [img]="ThumbsUp" class="size-4" /> <span>Like</span> </button> <button type="button" class="hover:bg-muted hover:text-foreground flex items-center justify-center gap-1.5 rounded-md py-2 transition-colors" > <lucide-icon [img]="MessageSquare" class="size-4" /> <span>Comment</span> </button> <button type="button" class="hover:bg-muted hover:text-foreground flex items-center justify-center gap-1.5 rounded-md py-2 transition-colors" > <lucide-icon [img]="Repeat2" class="size-4" /> <span>Repost</span> </button> <button type="button" class="hover:bg-muted hover:text-foreground flex items-center justify-center gap-1.5 rounded-md py-2 transition-colors" > <lucide-icon [img]="Send" class="size-4" /> <span>Send</span> </button> </div> </div> </ui-tabs-content> <ui-tabs-content value="instagram" class="mt-4"> <div class="border-border bg-card mx-auto max-w-md overflow-hidden rounded-xl border shadow-xs"> <div class="flex items-center justify-between p-3"> <div class="flex flex-wrap items-center gap-2.5"> <div class="rounded-full bg-gradient-to-tr from-amber-500 via-rose-500 to-purple-600 p-0.5"> <ui-avatar class="border-background size-8 border-2"> <ui-avatar-image [src]="profile.avatar" [alt]="profile.name" /> <ui-avatar-fallback>{{ profile.initials }}</ui-avatar-fallback> </ui-avatar> </div> <div> <div class="text-foreground text-xs font-semibold">{{ profile.instagramHandle }}</div> <div class="text-muted-foreground text-xs">San Francisco, California</div> </div> </div> <lucide-icon [img]="MoreHorizontal" class="text-muted-foreground size-4" /> </div> <div class="border-border/60 bg-muted/40 relative aspect-square w-full border-y"> @if (mediaUrl(); as url) { <img [src]="url" alt="Instagram post preview" class="size-full object-cover" /> } @else { <div class="text-muted-foreground flex size-full flex-col items-center justify-center gap-2 p-6 text-center" > <lucide-icon [img]="ImageIcon" class="size-10 stroke-[1.5]" /> <p class="text-xs">Attach an image on the left to see Instagram photo preview</p> </div> } </div> <div class="space-y-2 p-3"> <div class="flex items-center justify-between"> <div class="flex items-center gap-3"> <lucide-icon [img]="Heart" class="size-5 cursor-pointer transition-colors" [class.fill-destructive]="isLikedInPreview()" [class.text-destructive]="isLikedInPreview()" [class.text-foreground]="!isLikedInPreview()" (click)="toggleLike()" /> <lucide-icon [img]="MessageCircle" class="text-foreground hover:text-muted-foreground size-5 cursor-pointer" /> <lucide-icon [img]="Send" class="text-foreground hover:text-muted-foreground size-5 cursor-pointer" /> </div> <lucide-icon [img]="Bookmark" class="text-foreground hover:text-muted-foreground size-5 cursor-pointer" /> </div> <div class="text-foreground text-xs font-semibold"> {{ isLikedInPreview() ? '343 likes' : '342 likes' }} </div> <div class="text-foreground text-xs leading-relaxed"> <span class="mr-1.5 font-semibold">{{ profile.instagramHandle }}</span> @for (seg of segments(); track $index) { @if (seg.isHashtag) { <span class="text-info cursor-pointer font-medium hover:underline">{{ seg.text }}</span> } @else { <span>{{ seg.text }}</span> } } </div> <div class="text-muted-foreground cursor-pointer text-xs">View all 28 comments</div> <div class="text-muted-foreground text-xs tracking-wider uppercase"> SCHEDULED FOR {{ scheduledDate() }} · {{ scheduledTime() }} </div> </div> </div> </ui-tabs-content> <ui-tabs-content value="threads" class="mt-4"> <div class="border-border bg-card rounded-xl border p-4 shadow-xs"> <div class="flex items-start gap-3"> <div class="flex flex-col items-center"> <ui-avatar class="size-10"> <ui-avatar-image [src]="profile.avatar" [alt]="profile.name" /> <ui-avatar-fallback>{{ profile.initials }}</ui-avatar-fallback> </ui-avatar> <div class="bg-border mt-2 h-20 w-0.5 rounded-full"></div> </div> <div class="flex-1 space-y-2"> <div class="flex items-center justify-between"> <div class="flex items-center gap-1.5"> <span class="text-foreground text-sm font-semibold">{{ profile.threadsHandle }}</span> <svg class="fill-info text-info size-3.5 shrink-0" viewBox="0 0 24 24"> <path fill-rule="evenodd" clip-rule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.004 6.308a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" /> </svg> <span class="text-muted-foreground text-xs">· Scheduled</span> </div> <lucide-icon [img]="MoreHorizontal" class="text-muted-foreground size-4" /> </div> <div class="text-foreground text-sm leading-relaxed whitespace-pre-wrap"> @for (seg of segments(); track $index) { @if (seg.isHashtag) { <span class="text-foreground cursor-pointer font-semibold hover:underline">{{ seg.text }}</span> } @else { <span>{{ seg.text }}</span> } } @if (!content()) { <span class="text-muted-foreground italic">Post body is empty...</span> } </div> @if (mediaUrl(); as url) { <div class="border-border mt-3 overflow-hidden rounded-xl border"> <img [src]="url" alt="Post preview image" class="max-h-72 w-full object-cover" /> </div> } <div class="flex items-center gap-4 pt-2"> <lucide-icon [img]="Heart" class="size-4 cursor-pointer transition-colors" [class.fill-destructive]="isLikedInPreview()" [class.text-destructive]="isLikedInPreview()" [class.text-muted-foreground]="!isLikedInPreview()" (click)="toggleLike()" /> <lucide-icon [img]="MessageCircle" class="text-muted-foreground hover:text-foreground size-4 cursor-pointer" /> <lucide-icon [img]="Repeat2" class="text-muted-foreground hover:text-foreground size-4 cursor-pointer" /> <lucide-icon [img]="Send" class="text-muted-foreground hover:text-foreground size-4 cursor-pointer" /> </div> <div class="text-muted-foreground pt-1 text-xs">48 replies · 312 likes</div> </div> </div> </div> </ui-tabs-content> </ui-tabs> </div> <div ui-card-footer class="border-border/60 text-muted-foreground flex items-center justify-between border-t pt-4 text-xs" > <span>Synchronized with Buffer & Hootsuite OAuth queues</span> <div class="flex items-center gap-1.5"> <span class="bg-success size-2 rounded-full"></span> <span>4 channels ready</span> </div> </div> </div> </section> </div> </div> `, }) export class UiSocialMediaPostSchedulerComponent { protected readonly Bookmark = Bookmark protected readonly Calendar = Calendar protected readonly Check = Check protected readonly CheckCircle2 = CheckCircle2 protected readonly Clock = Clock protected readonly Eye = Eye protected readonly Globe = Globe protected readonly Heart = Heart protected readonly ImageIcon = ImageIcon protected readonly MessageCircle = MessageCircle protected readonly MessageSquare = MessageSquare protected readonly MoreHorizontal = MoreHorizontal protected readonly Repeat2 = Repeat2 protected readonly Send = Send protected readonly Share2 = Share2 protected readonly Sparkles = Sparkles protected readonly ThumbsUp = ThumbsUp protected readonly Trash2 = Trash2 protected readonly UploadCloud = UploadCloud protected readonly X = X @Input() set initialContent(v: string | undefined) { if (v !== undefined) this.content.set(v) } @Input() set initialChannels(v: string[] | undefined) { if (v !== undefined) this.selectedChannels.set([...v]) } @Input() set initialMediaUrl(v: string | undefined) { if (v !== undefined) this.mediaUrl.set(v ?? null) } @Input() set initialDate(v: string | undefined) { if (v !== undefined) this.scheduledDate.set(v) } @Input() set initialTime(v: string | undefined) { if (v !== undefined) this.scheduledTime.set(v) } @Input() set initialAutoRepost(v: boolean | undefined) { if (v !== undefined) this.autoRepost.set(!!v) } readonly content = signal(defaultContent) readonly selectedChannels = signal<string[]>(['twitter', 'linkedin', 'instagram', 'threads']) readonly activeTab = signal('twitter') readonly mediaUrl = signal<string | null>( 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?q=80&w=1200&auto=format&fit=crop', ) readonly scheduledDate = signal('2026-08-25') readonly scheduledTime = signal('10:00 AM EST') readonly autoRepost = signal(true) readonly firstCommentThread = signal(true) readonly isLikedInPreview = signal(false) readonly notificationMessage = signal<string | null>(null) readonly notificationType = signal<'success' | 'draft'>('success') readonly profile = author readonly samples = sampleImages readonly hashtags = suggestedHashtags readonly emojis = quickEmojis readonly slots = timeSlots readonly currentLength = computed(() => this.content().length) readonly currentPlatformLimit = computed(() => platformLimits[this.activeTab()]?.limit ?? 280) readonly isOverLimit = computed(() => this.currentLength() > this.currentPlatformLimit()) readonly isWarningLimit = computed( () => this.currentLength() > this.currentPlatformLimit() - 40 && !this.isOverLimit(), ) readonly segments = computed(() => { const text = this.content() if (!text) return [] return text.split(/(\s+)/).map((word) => ({ text: word, isHashtag: word.startsWith('#') && word.length > 1, })) }) counterVariant(): 'destructive' | 'warning' | 'secondary' { if (this.isOverLimit()) return 'destructive' if (this.isWarningLimit()) return 'warning' return 'secondary' } get notificationClass(): string { return cn( 'flex items-center justify-between rounded-lg border p-3.5 text-sm shadow-xs transition-colors', this.notificationType() === 'success' ? 'border-success/30 bg-success/10 text-success' : 'bg-primary/10 border-primary/20 text-primary', ) } channelClass(channelId: string, activeClasses: string): string { return cn( 'group focus-visible:ring-ring relative flex flex-col items-start gap-1.5 rounded-lg border p-3 text-left transition-colors focus-visible:ring-2 focus-visible:outline-none', this.isChannelSelected(channelId) ? activeClasses : 'border-border bg-card hover:bg-accent/50 opacity-65', ) } checkClass(channelId: string, activeClasses: string): string { return cn( 'flex size-4 items-center justify-center rounded-full text-xs', this.isChannelSelected(channelId) ? activeClasses : 'border-border border', ) } hashtagClass(tag: string): string { return cn( 'focus-visible:ring-ring min-h-6 rounded-md border px-2 py-0.5 text-xs font-medium transition-colors focus-visible:ring-1 focus-visible:outline-none', this.content().includes(tag) ? 'border-primary/40 bg-primary/10 text-primary' : 'border-border bg-card text-muted-foreground hover:border-foreground/30 hover:text-foreground', ) } sampleClass(url: string): string { return cn( 'focus-visible:ring-ring min-h-6 rounded-md border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:ring-1 focus-visible:outline-none', this.mediaUrl() === url ? 'border-primary bg-primary/10 text-primary' : 'border-border bg-card text-muted-foreground hover:text-foreground', ) } slotClass(slot: string): string { return cn( 'focus-visible:ring-ring min-h-6 rounded border px-2 py-0.5 text-xs transition-colors focus-visible:ring-1 focus-visible:outline-none', this.scheduledTime() === slot ? 'border-primary bg-primary text-primary-foreground font-medium' : 'border-border bg-card text-muted-foreground hover:text-foreground', ) } toggleChannel(channelId: string): void { this.selectedChannels.update((prev) => { if (prev.includes(channelId)) { if (prev.length > 1) return prev.filter((c) => c !== channelId) return prev } return [...prev, channelId] }) } isChannelSelected(channelId: string): boolean { return this.selectedChannels().includes(channelId) } insertHashtag(tag: string): void { const current = this.content() if (current.includes(tag)) return this.content.set(!current.trim() ? tag : `${current.trim()} ${tag}`) } insertEmoji(emoji: string): void { this.content.update((prev) => `${prev}${emoji}`) } polishWithAi(): void { this.content.set( '🚀 Excited to announce our newest UI component release! Built with zero-dependency headless primitives, fluid spring physics, and full OKLCH dark mode tokens.\n\nExplore the interactive playground & let us know your thoughts below! 👇\n\n#UI #Developer #OpenSource #DesignSystem', ) } setPresetImage(url: string): void { this.mediaUrl.set(url) } removeMedia(): void { this.mediaUrl.set(null) } saveDraft(): void { this.notificationType.set('draft') this.notificationMessage.set( 'Post draft saved locally. All changes, media attachments, and channel targets are up to date.', ) } schedulePost(): void { this.notificationType.set('success') this.notificationMessage.set( `Post scheduled for ${this.scheduledDate()} at ${this.scheduledTime()} across ${this.selectedChannels().length} connected channels!`, ) } dismissNotification(): void { this.notificationMessage.set(null) } toggleLike(): void { this.isLikedInPreview.update((v) => !v) } }src/app/components/blocks/social-media-post-scheduler/index.ts0.1 kB
export { UiSocialMediaPostSchedulerComponent } from './social-media-post-scheduler.component'
Raw manifest:https://uipkge.dev/r/angular/social-media-post-scheduler.json