MCPcopy Create free account
hub / github.com/dailydotdev/apps / WriteFooter

Function WriteFooter

packages/shared/src/components/post/write/WriteFooter.tsx:18–75  ·  view source on GitHub ↗
({
  isLoading,
  className,
  isPoll,
}: WriteFooterProps)

Source from the content-addressed store, hash-verified

16}
17
18export function WriteFooter({
19 isLoading,
20 className,
21 isPoll,
22}: WriteFooterProps): ReactElement {
23 const { sidebarRendered } = useSidebarRendered();
24 const { schedule } = useWritePostContext();
25 const { shouldShowCta, isEnabled, onToggle, onSubmitted } =
26 useNotificationToggle();
27
28 return (
29 <span
30 className={classNames(
31 'relative flex flex-col flex-wrap tablet:flex-row',
32 !sidebarRendered && 'justify-center',
33 isPoll ? 'tablet:items-end' : 'items-center',
34 className,
35 )}
36 >
37 {isPoll && <PollDurationDropdown />}
38 {shouldShowCta && (
39 <Switch
40 data-testid="push_notification-switch"
41 inputId="push_notification-switch"
42 name="push_notification"
43 labelClassName="flex-1 font-normal"
44 className="py-3"
45 compact={false}
46 checked={isEnabled}
47 onToggle={onToggle}
48 >
49 Receive updates whenever your Squad members engage with your post
50 </Switch>
51 )}
52 <div
53 className={classNames(
54 'ml-auto hidden w-full items-center gap-2 tablet:w-auto laptop:flex',
55 shouldShowCta && 'mt-6',
56 )}
57 >
58 {schedule && (
59 <SchedulePostControl schedule={schedule} disabled={isLoading} />
60 )}
61 <Button
62 type="submit"
63 variant={ButtonVariant.Primary}
64 color={ButtonColor.Cabbage}
65 className="w-full tablet:mt-0 tablet:w-32"
66 disabled={isLoading}
67 loading={isLoading}
68 onClick={onSubmitted}
69 >
70 {schedule?.isScheduled ? 'Schedule' : 'Post'}
71 </Button>
72 </div>
73 </span>
74 );
75}

Callers

nothing calls this directly

Calls 3

useWritePostContextFunction · 0.90
useNotificationToggleFunction · 0.90
useSidebarRenderedFunction · 0.85

Tested by

no test coverage detected