@thewhatmatters/wmds 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/CONSUMING.md +5 -4
- package/README.md +3 -3
- package/dist/components/molecules/PromptBar/PromptBar.d.ts +11 -1
- package/dist/components/molecules/PromptBar/PromptBar.d.ts.map +1 -1
- package/dist/components/molecules/PromptBar/PromptBar.js +54 -43
- package/dist/components/molecules/PromptBar/promptBarStyles.d.ts +15 -0
- package/dist/components/molecules/PromptBar/promptBarStyles.d.ts.map +1 -1
- package/dist/components/molecules/PromptBar/promptBarStyles.js +5 -2
- package/dist/components/organisms/ChatDock/ChatDock.d.ts +93 -0
- package/dist/components/organisms/ChatDock/ChatDock.d.ts.map +1 -0
- package/dist/components/organisms/ChatDock/ChatDock.js +255 -0
- package/dist/components/organisms/ChatDock/chatDockStyles.d.ts +48 -0
- package/dist/components/organisms/ChatDock/chatDockStyles.d.ts.map +1 -0
- package/dist/components/organisms/ChatDock/chatDockStyles.js +15 -0
- package/dist/components/organisms/Dialog/AlertDialog.js +11 -11
- package/dist/components/organisms/Dialog/Dialog.js +44 -44
- package/dist/components/organisms/Sheet/Sheet.js +38 -38
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -28
- package/dist/styles.css +1 -1
- package/docs/component-contracts.md +1 -1
- package/docs/components.md +7 -6
- package/docs/exports.json +14 -14
- package/docs/patterns/components-avatar--dropdown-row.tsx +1 -1
- package/docs/patterns/components-badge--with-avatar.tsx +1 -1
- package/docs/patterns/components-button-button--destructive-action.tsx +1 -1
- package/docs/patterns/components-button-button--ghost-action.tsx +1 -1
- package/docs/patterns/components-button-button--inverse-action.tsx +1 -1
- package/docs/patterns/components-button-button--link-render.tsx +1 -1
- package/docs/patterns/components-button-button--multi-state-badge.tsx +1 -1
- package/docs/patterns/components-button-button--outline-mono.tsx +1 -1
- package/docs/patterns/components-button-button--primary-action.tsx +1 -1
- package/docs/patterns/components-button-button--row-hug.tsx +1 -1
- package/docs/patterns/components-button-button--row-layout.tsx +1 -1
- package/docs/patterns/components-button-button--secondary-action.tsx +1 -1
- package/docs/patterns/components-button-button--suggestion-pills.tsx +1 -1
- package/docs/patterns/components-button-button--with-count.tsx +1 -1
- package/docs/patterns/components-button-button--with-icon.tsx +1 -1
- package/docs/patterns/components-button-floatingactionbutton--vertical-actions.tsx +1 -1
- package/docs/patterns/components-calembed--pattern-skip-in-footer.tsx +1 -1
- package/docs/patterns/components-card-card--body-slot-occupancy-history.tsx +1 -1
- package/docs/patterns/components-card-card--headerless-media.tsx +1 -1
- package/docs/patterns/components-card-card--outlined-layout.tsx +1 -1
- package/docs/patterns/components-card-card--pinned-height.tsx +1 -1
- package/docs/patterns/components-card-selectablecard--selectable-cards-pattern.tsx +1 -1
- package/docs/patterns/components-chart--audience-activity-heatmap.tsx +1 -1
- package/docs/patterns/components-chart--cartesian-no-data-gaps.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-history-in-card.tsx +1 -1
- package/docs/patterns/components-chart--occupancy-in-card.tsx +1 -1
- package/docs/patterns/components-chart--post-reach-distribution.tsx +1 -1
- package/docs/patterns/components-chart--ranked-audience-breakdown.tsx +1 -1
- package/docs/patterns/components-chart--unit-grid-composition.tsx +1 -1
- package/docs/patterns/components-chatdock--pattern-chat-dock.tsx +68 -0
- package/docs/patterns/components-chatqa--pattern-qa-with-reply.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--default.tsx +1 -1
- package/docs/patterns/components-checkbox-checkbox--with-description.tsx +1 -1
- package/docs/patterns/components-checkbox-checkboxgroup--default.tsx +1 -1
- package/docs/patterns/components-dialog--alert-dialog-destructive.tsx +1 -1
- package/docs/patterns/components-dialog--default-dialog.tsx +1 -1
- package/docs/patterns/components-dialog--form-dialog.tsx +1 -1
- package/docs/patterns/components-displaycontrols--page-utilities.tsx +1 -1
- package/docs/patterns/components-field--horizontal-input.tsx +1 -1
- package/docs/patterns/components-field--horizontal-text-area.tsx +1 -1
- package/docs/patterns/components-field--multi-control.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-ruled-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-footerreveal--marketing-page-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--ruled-grid-footer-pattern.tsx +1 -1
- package/docs/patterns/components-footerreveal--sequenced-marketing-hero.tsx +1 -1
- package/docs/patterns/components-herointro--two-line-intro.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-pattern.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-text-sequence.tsx +1 -1
- package/docs/patterns/components-herotilestack--marketing-hero-with-gallery-intro.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--booked-pattern.tsx +1 -1
- package/docs/patterns/components-intakeconfirmation--emailed-pattern.tsx +1 -1
- package/docs/patterns/components-intakeform--about-you-pattern.tsx +1 -1
- package/docs/patterns/components-intakemodal--intake-modal-pattern.tsx +1 -1
- package/docs/patterns/components-kbd--command-row.tsx +1 -1
- package/docs/patterns/components-kbd--numbered-choices.tsx +1 -1
- package/docs/patterns/components-kbd--shortcut.tsx +1 -1
- package/docs/patterns/components-moremenu--action-menu.tsx +1 -1
- package/docs/patterns/components-moremenu--in-card-header.tsx +1 -1
- package/docs/patterns/components-navlist--side-nav-settings.tsx +1 -1
- package/docs/patterns/components-pageheader--app-header-pattern.tsx +1 -1
- package/docs/patterns/components-pageheader--page-section-header.tsx +1 -1
- package/docs/patterns/components-pageheader--toolbar-header.tsx +1 -1
- package/docs/patterns/components-panel--end-detail-rail.tsx +1 -1
- package/docs/patterns/components-pillgroup--pill-group-pattern.tsx +1 -1
- package/docs/patterns/components-promptbar--pattern-prompt-bar.tsx +1 -1
- package/docs/patterns/components-radio-radiogroup--default.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--project-gallery-pattern.tsx +1 -1
- package/docs/patterns/components-scrollhorizontal--with-intro.tsx +1 -1
- package/docs/patterns/components-sheet--bottom-sheet.tsx +1 -1
- package/docs/patterns/components-sheet--end-sheet.tsx +1 -1
- package/docs/patterns/components-sitenav--brand-and-cta.tsx +1 -1
- package/docs/patterns/components-sitenav--centered-links.tsx +1 -1
- package/docs/patterns/components-sitenav--compact.tsx +1 -1
- package/docs/patterns/components-sitenav--marketing-header.tsx +1 -1
- package/docs/patterns/components-sitenav--mega-menu.tsx +1 -1
- package/docs/patterns/components-stat--insights-row.tsx +1 -1
- package/docs/patterns/components-stepprogress--step-progress-pattern.tsx +1 -1
- package/docs/patterns/components-switch--default.tsx +1 -1
- package/docs/patterns/components-switch--settings-row.tsx +1 -1
- package/docs/patterns/components-tab--settings-pages.tsx +1 -1
- package/docs/patterns/components-taskrows--action-details.tsx +1 -1
- package/docs/patterns/components-taskrows--capsules.tsx +1 -1
- package/docs/patterns/components-taskrows--card-with-status-rows.tsx +1 -1
- package/docs/patterns/components-taskrows--controlled-expand.tsx +1 -1
- package/docs/patterns/components-taskrows--custom-slots.tsx +1 -1
- package/docs/patterns/components-taskrows--status-list.tsx +1 -1
- package/docs/patterns/components-taskrows--tag-chips.tsx +1 -1
- package/docs/patterns/components-textlink--external-destination.tsx +1 -1
- package/docs/patterns/components-textlink--inline-prose.tsx +1 -1
- package/docs/patterns/components-textlink--supporting-copy.tsx +1 -1
- package/docs/patterns/components-textsequence--default.tsx +1 -1
- package/docs/patterns/components-textsequence--reduced-motion.tsx +1 -1
- package/docs/patterns/components-textsequence--shapes.tsx +1 -1
- package/docs/patterns/components-toast--stacked-notifications.tsx +1 -1
- package/docs/patterns/components-tooltip--controlled.tsx +1 -1
- package/docs/patterns/components-tooltip--disabled-control.tsx +1 -1
- package/docs/patterns/components-tooltip--icon-action.tsx +1 -1
- package/docs/patterns/components-tooltip--keyboard-shortcut.tsx +1 -1
- package/docs/patterns/components-tooltip--placement.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--horizontal-rail.tsx +1 -1
- package/docs/patterns/foundations-scroll-fade--overflowing-list.tsx +1 -1
- package/docs/patterns/guides-chart-explorations--comparison-gallery.tsx +1 -1
- package/docs/patterns/guides-overlay-flows--notification-preferences.tsx +1 -1
- package/docs/patterns/guides-profile-typography--editorial-profile.tsx +1 -1
- package/docs/patterns/index.json +9 -161
- package/package.json +1 -1
- package/docs/patterns/components-promptbar--pattern-marketing-composer.tsx +0 -37
- package/docs/patterns/sites-pitchkit-account-settings--account-settings-owner.tsx +0 -265
- package/docs/patterns/sites-pitchkit-creator-identity--creator-identity-owner-settings.tsx +0 -154
- package/docs/patterns/sites-pitchkit-creator-identity--creator-identity-public.tsx +0 -96
- package/docs/patterns/sites-pitchkit-insights-and-kit--creator-insights-loading.tsx +0 -1006
- package/docs/patterns/sites-pitchkit-insights-and-kit--creator-insights.tsx +0 -1031
- package/docs/patterns/sites-pitchkit-insights-and-kit--insufficient-audience-data.tsx +0 -1015
- package/docs/patterns/sites-pitchkit-insights-and-kit--insufficient-reach-and-audience-data.tsx +0 -1017
- package/docs/patterns/sites-pitchkit-insights-and-kit--insufficient-reach-data.tsx +0 -1033
- package/docs/patterns/sites-pitchkit-insights-and-kit--owner-pitch-kit.tsx +0 -838
- package/docs/patterns/sites-pitchkit-insights-and-kit--shareable-pitch-kit.tsx +0 -608
- package/docs/patterns/sites-pitchkit-intro--intro-owner.tsx +0 -161
- package/docs/patterns/sites-pitchkit-intro--intro-public.tsx +0 -111
- package/docs/patterns/sites-pitchkit-past-brands--past-brands-owner.tsx +0 -611
- package/docs/patterns/sites-pitchkit-past-brands--past-brands-public.tsx +0 -299
- package/docs/patterns/sites-pitchkit-theme-picker--theme-picker-owner.tsx +0 -832
- package/docs/patterns/sites-whatmatters-intake--start-a-project-pattern.tsx +0 -234
- package/docs/patterns/sites-whatmatters-marketing-landing--marketing-landing.tsx +0 -87
- package/docs/patterns/sites-whatmatters-prompt-chat--landing-to-chat.tsx +0 -899
- package/docs/patterns/sites-whatmatters-rfp-submitted--rfp-submitted.tsx +0 -302
|
@@ -1,1033 +0,0 @@
|
|
|
1
|
-
// @thewhatmatters/wmds@0.2.0 · State — insufficient reach data
|
|
2
|
-
// Storybook: Sites/PitchKit/Insights and kit → State — insufficient reach data (?path=/story/sites-pitchkit-insights-and-kit--insufficient-reach-data)
|
|
3
|
-
// Show code — copy verbatim and keep this header; upgrades find pasted patterns by it.
|
|
4
|
-
|
|
5
|
-
import { useLayoutEffect, useRef, useState, type CSSProperties } from "react";
|
|
6
|
-
import {
|
|
7
|
-
AlertDialog,
|
|
8
|
-
Avatar,
|
|
9
|
-
Badge,
|
|
10
|
-
Button,
|
|
11
|
-
ButtonIcon,
|
|
12
|
-
Card,
|
|
13
|
-
Chart,
|
|
14
|
-
Chip,
|
|
15
|
-
Dialog,
|
|
16
|
-
Dropdown,
|
|
17
|
-
MoreMenu,
|
|
18
|
-
PageHeader,
|
|
19
|
-
SegmentedControl,
|
|
20
|
-
Stat,
|
|
21
|
-
Tab,
|
|
22
|
-
TextLink,
|
|
23
|
-
Toaster,
|
|
24
|
-
cardSubtitleClasses,
|
|
25
|
-
cardTitleClasses,
|
|
26
|
-
chartSeriesConfigFromKeys,
|
|
27
|
-
toast,
|
|
28
|
-
type ChartCartesianPoint,
|
|
29
|
-
type ChartRankedBarItem,
|
|
30
|
-
} from "@thewhatmatters/wmds";
|
|
31
|
-
import { EyeOff } from "lucide-react";
|
|
32
|
-
|
|
33
|
-
const reachConfig = chartSeriesConfigFromKeys([
|
|
34
|
-
{ key: "typical", label: "Typical reach" },
|
|
35
|
-
{ key: "reach", label: "Daily reach" },
|
|
36
|
-
]);
|
|
37
|
-
|
|
38
|
-
const compactNumber = new Intl.NumberFormat("en", {
|
|
39
|
-
notation: "compact",
|
|
40
|
-
maximumFractionDigits: 1,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
type PitchKitProofMetric = "reach" | "engagement" | "saves";
|
|
44
|
-
|
|
45
|
-
const proofMetricNotices: Record<PitchKitProofMetric, string> = {
|
|
46
|
-
reach: "Ranked by Instagram reach.",
|
|
47
|
-
engagement: "Ranked by likes + comments.",
|
|
48
|
-
saves: "Ranked by Instagram saves.",
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
function proofMetricValue(post: PitchKitPost, metric: PitchKitProofMetric) {
|
|
52
|
-
if (metric === "engagement") return post.likes + post.comments;
|
|
53
|
-
return post[metric];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
export interface PitchKitAudience {
|
|
58
|
-
countries: ChartRankedBarItem[];
|
|
59
|
-
cities: ChartRankedBarItem[];
|
|
60
|
-
ages: ChartRankedBarItem[];
|
|
61
|
-
gender: ChartRankedBarItem[];
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function AudienceSection({ title, items }: { title: string; items: ChartRankedBarItem[] }) {
|
|
65
|
-
return (
|
|
66
|
-
<section className="flex min-w-0 flex-col gap-3">
|
|
67
|
-
<h3 className="type-supporting font-medium uppercase tracking-wider text-muted text-muted">{title}</h3>
|
|
68
|
-
<Chart.RankedBars
|
|
69
|
-
aria-label={`Audience by ${title.toLowerCase()}`}
|
|
70
|
-
items={items}
|
|
71
|
-
animate="initial"
|
|
72
|
-
/>
|
|
73
|
-
</section>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
function copyShareKitUrl(handle: string) {
|
|
79
|
-
const path = `/k/${handle}`;
|
|
80
|
-
void navigator.clipboard.writeText(path);
|
|
81
|
-
toast.add({
|
|
82
|
-
title: "Kit URL copied",
|
|
83
|
-
description: path,
|
|
84
|
-
tone: "success",
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function AccountSettingsDialog({
|
|
89
|
-
identity,
|
|
90
|
-
open,
|
|
91
|
-
onOpenChange,
|
|
92
|
-
}: {
|
|
93
|
-
identity: PitchKitCreatorIdentity;
|
|
94
|
-
open: boolean;
|
|
95
|
-
onOpenChange: (open: boolean) => void;
|
|
96
|
-
}) {
|
|
97
|
-
return (
|
|
98
|
-
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
99
|
-
<Dialog.Content size="md" title="Account settings">
|
|
100
|
-
<div className="flex w-full min-w-0 flex-col gap-4">
|
|
101
|
-
<Card variant="outlined" shape="rounded" bodyTerminal className="col-span-full">
|
|
102
|
-
<Card.Header
|
|
103
|
-
start={<h2 className={cardTitleClasses}>Connected Instagram</h2>}
|
|
104
|
-
end={
|
|
105
|
-
identity.connected ? (
|
|
106
|
-
<Badge variant="success" emphasis="muted" size="sm">
|
|
107
|
-
Connected
|
|
108
|
-
</Badge>
|
|
109
|
-
) : null
|
|
110
|
-
}
|
|
111
|
-
/>
|
|
112
|
-
<Card.Body>
|
|
113
|
-
<div className="flex min-w-0 flex-col gap-4 px-3.5 py-[16px]">
|
|
114
|
-
<CreatorIdentityStrip
|
|
115
|
-
identity={identity}
|
|
116
|
-
nameAs="p"
|
|
117
|
-
showProfessionalChip
|
|
118
|
-
/>
|
|
119
|
-
{identity.lastSyncedLabel != null ? (
|
|
120
|
-
<p className="type-supporting text-muted text-muted">
|
|
121
|
-
Last synced {identity.lastSyncedLabel}
|
|
122
|
-
</p>
|
|
123
|
-
) : null}
|
|
124
|
-
</div>
|
|
125
|
-
</Card.Body>
|
|
126
|
-
</Card>
|
|
127
|
-
</div>
|
|
128
|
-
</Dialog.Content>
|
|
129
|
-
</Dialog>
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function OwnerAccountMenu({ identity }: { identity: PitchKitCreatorIdentity }) {
|
|
134
|
-
const [menuOpen, setMenuOpen] = useState(false);
|
|
135
|
-
const [settingsOpen, setSettingsOpen] = useState(false);
|
|
136
|
-
const [deleteOpen, setDeleteOpen] = useState(false);
|
|
137
|
-
|
|
138
|
-
function handleAction(actionId: string) {
|
|
139
|
-
setMenuOpen(false);
|
|
140
|
-
if (actionId === "settings") {
|
|
141
|
-
setSettingsOpen(true);
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (actionId === "share") {
|
|
145
|
-
copyShareKitUrl(identity.handle);
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
if (actionId === "delete") {
|
|
149
|
-
setDeleteOpen(true);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return (
|
|
154
|
-
<>
|
|
155
|
-
<div className="relative">
|
|
156
|
-
<Button
|
|
157
|
-
type="button"
|
|
158
|
-
role="ghost"
|
|
159
|
-
size="sm"
|
|
160
|
-
aria-label="My account"
|
|
161
|
-
aria-haspopup="menu"
|
|
162
|
-
aria-expanded={menuOpen}
|
|
163
|
-
className="size-9 min-h-9 gap-0 px-0 py-0 focus-visible:ring-offset-0"
|
|
164
|
-
onClick={() => setMenuOpen((open) => !open)}
|
|
165
|
-
>
|
|
166
|
-
<Avatar
|
|
167
|
-
name={identity.displayName ?? identity.handle}
|
|
168
|
-
src={identity.profilePictureUrl}
|
|
169
|
-
size="md"
|
|
170
|
-
/>
|
|
171
|
-
</Button>
|
|
172
|
-
{menuOpen ? (
|
|
173
|
-
<Dropdown.Menu
|
|
174
|
-
role="menu"
|
|
175
|
-
aria-label="My account"
|
|
176
|
-
className="absolute end-0 top-full mt-1 min-w-56"
|
|
177
|
-
>
|
|
178
|
-
<li role="presentation">
|
|
179
|
-
<p className="type-supporting font-medium uppercase tracking-wider text-muted px-3.5 py-2">My account</p>
|
|
180
|
-
</li>
|
|
181
|
-
<li role="presentation">
|
|
182
|
-
<Dropdown.Item role="menuitem" truncate={false} onClick={() => handleAction("settings")}>
|
|
183
|
-
Account settings
|
|
184
|
-
</Dropdown.Item>
|
|
185
|
-
</li>
|
|
186
|
-
<li role="presentation">
|
|
187
|
-
<Dropdown.Item role="menuitem" truncate={false} onClick={() => handleAction("share")}>
|
|
188
|
-
Share kit
|
|
189
|
-
</Dropdown.Item>
|
|
190
|
-
</li>
|
|
191
|
-
<li role="separator" className="mx-1.5 my-0.5 border-0 border-t border-border" />
|
|
192
|
-
<li role="presentation">
|
|
193
|
-
<Dropdown.Item role="menuitem" truncate={false} onClick={() => handleAction("signout")}>
|
|
194
|
-
Sign out
|
|
195
|
-
</Dropdown.Item>
|
|
196
|
-
</li>
|
|
197
|
-
<li role="presentation">
|
|
198
|
-
<Dropdown.Item role="menuitem" truncate={false} onClick={() => handleAction("disconnect")}>
|
|
199
|
-
Disconnect
|
|
200
|
-
</Dropdown.Item>
|
|
201
|
-
</li>
|
|
202
|
-
<li role="presentation">
|
|
203
|
-
<Dropdown.Item role="menuitem" truncate={false} onClick={() => handleAction("delete")}>Delete</Dropdown.Item>
|
|
204
|
-
</li>
|
|
205
|
-
</Dropdown.Menu>
|
|
206
|
-
) : null}
|
|
207
|
-
</div>
|
|
208
|
-
<AccountSettingsDialog
|
|
209
|
-
identity={identity}
|
|
210
|
-
open={settingsOpen}
|
|
211
|
-
onOpenChange={setSettingsOpen}
|
|
212
|
-
/>
|
|
213
|
-
<AlertDialog
|
|
214
|
-
open={deleteOpen}
|
|
215
|
-
onOpenChange={setDeleteOpen}
|
|
216
|
-
title="Delete your Pitchkit account?"
|
|
217
|
-
description="This permanently deletes your kit, stored media copies, and connection. Your Instagram account is not deleted. This cannot be undone."
|
|
218
|
-
cancelLabel="Cancel"
|
|
219
|
-
confirmLabel="Delete account"
|
|
220
|
-
confirmRole="destructive"
|
|
221
|
-
onConfirm={() => setDeleteOpen(false)}
|
|
222
|
-
/>
|
|
223
|
-
</>
|
|
224
|
-
);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
function PitchKitPageFooter() {
|
|
228
|
-
return (
|
|
229
|
-
<div className="band pb-6 pt-10">
|
|
230
|
-
<footer className="col-span-full flex items-center justify-center gap-4">
|
|
231
|
-
<TextLink href="/privacy">Privacy</TextLink>
|
|
232
|
-
<TextLink href="mailto:hello@whatmatters.com">Support</TextLink>
|
|
233
|
-
</footer>
|
|
234
|
-
</div>
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
export interface PitchKitCreatorIdentity {
|
|
241
|
-
displayName?: string;
|
|
242
|
-
/** Without the @ — shown as @handle, shared as /k/[handle]. */
|
|
243
|
-
handle: string;
|
|
244
|
-
profilePictureUrl?: string;
|
|
245
|
-
followersCount?: number;
|
|
246
|
-
professionalAccount?: "Business" | "Creator";
|
|
247
|
-
connected?: boolean;
|
|
248
|
-
lastSyncedLabel?: string;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function CreatorIdentityStrip({
|
|
252
|
-
identity,
|
|
253
|
-
nameAs = "h1",
|
|
254
|
-
showProfessionalChip = false,
|
|
255
|
-
}: {
|
|
256
|
-
identity: PitchKitCreatorIdentity;
|
|
257
|
-
nameAs?: "h1" | "p";
|
|
258
|
-
showProfessionalChip?: boolean;
|
|
259
|
-
}) {
|
|
260
|
-
const NameTag = nameAs;
|
|
261
|
-
const avatarName = identity.displayName ?? identity.handle;
|
|
262
|
-
const handleLabel = `@${identity.handle}`;
|
|
263
|
-
const followerLabel =
|
|
264
|
-
identity.followersCount == null
|
|
265
|
-
? null
|
|
266
|
-
: `${compactNumber.format(identity.followersCount)} followers`;
|
|
267
|
-
const meta = [handleLabel, followerLabel].filter(Boolean).join(" · ");
|
|
268
|
-
const showTitleRow =
|
|
269
|
-
identity.displayName != null ||
|
|
270
|
-
(showProfessionalChip && identity.professionalAccount != null);
|
|
271
|
-
|
|
272
|
-
return (
|
|
273
|
-
<div className="flex flex-wrap items-center gap-4">
|
|
274
|
-
<Avatar
|
|
275
|
-
name={avatarName}
|
|
276
|
-
src={identity.profilePictureUrl}
|
|
277
|
-
size="lg"
|
|
278
|
-
/>
|
|
279
|
-
<div className="flex min-w-0 flex-col gap-1">
|
|
280
|
-
{showTitleRow ? (
|
|
281
|
-
<div className="flex flex-wrap items-center gap-2">
|
|
282
|
-
{identity.displayName != null ? (
|
|
283
|
-
<NameTag className="type-heading-2 text-fg">
|
|
284
|
-
{identity.displayName}
|
|
285
|
-
</NameTag>
|
|
286
|
-
) : null}
|
|
287
|
-
{showProfessionalChip && identity.professionalAccount != null ? (
|
|
288
|
-
<Chip readOnly size="sm">
|
|
289
|
-
{identity.professionalAccount}
|
|
290
|
-
</Chip>
|
|
291
|
-
) : null}
|
|
292
|
-
</div>
|
|
293
|
-
) : null}
|
|
294
|
-
<p className="type-body text-fg text-muted">{meta}</p>
|
|
295
|
-
</div>
|
|
296
|
-
</div>
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
export interface PitchKitPost {
|
|
302
|
-
id: string;
|
|
303
|
-
publishedAt: string;
|
|
304
|
-
imageUrl: string;
|
|
305
|
-
imageAlt: string;
|
|
306
|
-
saves: number;
|
|
307
|
-
reach: number;
|
|
308
|
-
likes: number;
|
|
309
|
-
comments: number;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
export interface PitchKitContact {
|
|
313
|
-
email: string;
|
|
314
|
-
websiteHref: string;
|
|
315
|
-
websiteLabel: string;
|
|
316
|
-
location: string;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
/** "insufficient" when the 30-day reach series cannot be plotted. */
|
|
320
|
-
export type PitchKitReachState = "resolved" | "insufficient";
|
|
321
|
-
|
|
322
|
-
export interface PitchKitPageData {
|
|
323
|
-
identity: PitchKitCreatorIdentity;
|
|
324
|
-
intro: string;
|
|
325
|
-
posts: PitchKitPost[];
|
|
326
|
-
contact: PitchKitContact;
|
|
327
|
-
brands: PitchKitPastBrand[];
|
|
328
|
-
countries: ChartRankedBarItem[];
|
|
329
|
-
reachData: ChartCartesianPoint[];
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
export interface PitchKitPastBrand {
|
|
334
|
-
id: string;
|
|
335
|
-
name: string;
|
|
336
|
-
/** Curated mark key — missing or unknown keys use a letter Avatar. */
|
|
337
|
-
logo_key?: string;
|
|
338
|
-
result_label?: string;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
const PITCHKIT_BRAND_RESULT_MAX = 24;
|
|
342
|
-
const PITCHKIT_BRAND_LOGO_LETTER = "letter";
|
|
343
|
-
|
|
344
|
-
const pitchKitBrandLogoKeys = [
|
|
345
|
-
"nike", "adidas", "apple", "google", "meta", "amazon", "spotify", "netflix",
|
|
346
|
-
"sephora", "glossier", "nordstrom", "target", "walmart", "starbucks",
|
|
347
|
-
"coca-cola", "pepsi", "samsung", "microsoft", "adobe", "shopify",
|
|
348
|
-
"uber", "airbnb", "disney", "lululemon", "reebok", "puma",
|
|
349
|
-
"dior", "chanel", "bmw", "ford", "chase", "visa",
|
|
350
|
-
];
|
|
351
|
-
|
|
352
|
-
const pastBrandLogoKeySet = new Set(pitchKitBrandLogoKeys);
|
|
353
|
-
|
|
354
|
-
function resolvePastBrandLogoKey(logoKey: string | null | undefined) {
|
|
355
|
-
if (logoKey == null || logoKey === "" || logoKey === PITCHKIT_BRAND_LOGO_LETTER) {
|
|
356
|
-
return undefined;
|
|
357
|
-
}
|
|
358
|
-
return pastBrandLogoKeySet.has(logoKey) ? logoKey : undefined;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
function pastBrandLogoMonogram(logoKey: string) {
|
|
362
|
-
const parts = logoKey.split("-");
|
|
363
|
-
if (parts.length > 1) {
|
|
364
|
-
return parts.map((part) => part.charAt(0).toUpperCase()).join("").slice(0, 2);
|
|
365
|
-
}
|
|
366
|
-
return logoKey.slice(0, 1).toUpperCase();
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
function normalizePastBrandResult(value: string | null | undefined) {
|
|
370
|
-
const trimmed = value?.trim() ?? "";
|
|
371
|
-
if (trimmed.length === 0) return undefined;
|
|
372
|
-
return trimmed.slice(0, PITCHKIT_BRAND_RESULT_MAX);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
function BrandMark({ name, logoKey }: { name: string; logoKey?: string }) {
|
|
376
|
-
const resolved = resolvePastBrandLogoKey(logoKey);
|
|
377
|
-
if (resolved == null) {
|
|
378
|
-
return <Avatar name={name} size="sm" />;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
return (
|
|
382
|
-
<span className="flex size-6 shrink-0 items-center justify-center rounded-full bg-fg type-supporting text-muted font-medium uppercase leading-none text-bg" role="img" aria-label={name}>
|
|
383
|
-
<span aria-hidden>{pastBrandLogoMonogram(resolved)}</span>
|
|
384
|
-
</span>
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
function BrandResultChip({ label }: { label?: string }) {
|
|
389
|
-
const result = normalizePastBrandResult(label);
|
|
390
|
-
if (result == null) return null;
|
|
391
|
-
return <Chip readOnly size="sm">{result}</Chip>;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
function BrandLockup({ brand }: { brand: PitchKitPastBrand }) {
|
|
395
|
-
return (
|
|
396
|
-
<div className="flex min-w-0 items-center gap-3">
|
|
397
|
-
<BrandMark name={brand.name} logoKey={brand.logo_key} />
|
|
398
|
-
<h3 className="type-label text-fg">{brand.name}</h3>
|
|
399
|
-
<BrandResultChip label={brand.result_label} />
|
|
400
|
-
</div>
|
|
401
|
-
);
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function PastBrandCard({ brand, className }: { brand: PitchKitPastBrand; className: string }) {
|
|
405
|
-
return (
|
|
406
|
-
<Card variant="outlined" shape="rounded" className={className}>
|
|
407
|
-
<Card.Header start={<BrandLockup brand={brand} />} />
|
|
408
|
-
</Card>
|
|
409
|
-
);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
function PastBrandsRail({ brands }: { brands: readonly PitchKitPastBrand[] }) {
|
|
413
|
-
const hostRef = useRef<HTMLDivElement>(null);
|
|
414
|
-
const measureRef = useRef<HTMLUListElement>(null);
|
|
415
|
-
const [overflows, setOverflows] = useState(false);
|
|
416
|
-
const [reduceMotion, setReduceMotion] = useState(false);
|
|
417
|
-
|
|
418
|
-
useLayoutEffect(() => {
|
|
419
|
-
const media = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
420
|
-
const updateMotion = () => setReduceMotion(media.matches);
|
|
421
|
-
updateMotion();
|
|
422
|
-
media.addEventListener("change", updateMotion);
|
|
423
|
-
return () => media.removeEventListener("change", updateMotion);
|
|
424
|
-
}, []);
|
|
425
|
-
|
|
426
|
-
useLayoutEffect(() => {
|
|
427
|
-
const host = hostRef.current;
|
|
428
|
-
const measure = measureRef.current;
|
|
429
|
-
if (host == null || measure == null) return;
|
|
430
|
-
|
|
431
|
-
const update = () => {
|
|
432
|
-
setOverflows(measure.scrollWidth > host.clientWidth + 1);
|
|
433
|
-
};
|
|
434
|
-
update();
|
|
435
|
-
const observer = new ResizeObserver(update);
|
|
436
|
-
observer.observe(host);
|
|
437
|
-
observer.observe(measure);
|
|
438
|
-
return () => observer.disconnect();
|
|
439
|
-
}, [brands]);
|
|
440
|
-
|
|
441
|
-
const duration = Math.max(16, brands.length * 4);
|
|
442
|
-
const showMarquee = overflows && !reduceMotion;
|
|
443
|
-
|
|
444
|
-
return (
|
|
445
|
-
<div
|
|
446
|
-
ref={hostRef}
|
|
447
|
-
className="relative col-span-full min-w-0"
|
|
448
|
-
data-overflow={showMarquee ? "true" : "false"}
|
|
449
|
-
>
|
|
450
|
-
<ul ref={measureRef} className="pointer-events-none invisible absolute flex w-max items-center gap-3" aria-hidden>
|
|
451
|
-
{brands.map((brand) => (
|
|
452
|
-
<li key={`${brand.id}-measure`}>
|
|
453
|
-
<PastBrandCard brand={brand} className="w-max max-w-full shrink-0" />
|
|
454
|
-
</li>
|
|
455
|
-
))}
|
|
456
|
-
</ul>
|
|
457
|
-
{reduceMotion ? (
|
|
458
|
-
<ul className="flex min-w-0 flex-wrap items-center gap-3" aria-label="Past brands">
|
|
459
|
-
{brands.map((brand) => (
|
|
460
|
-
<li key={brand.id}>
|
|
461
|
-
<PastBrandCard brand={brand} className="w-max max-w-full shrink-0" />
|
|
462
|
-
</li>
|
|
463
|
-
))}
|
|
464
|
-
</ul>
|
|
465
|
-
) : showMarquee ? (
|
|
466
|
-
<>
|
|
467
|
-
<ul className="sr-only" aria-label="Past brands">
|
|
468
|
-
{brands.map((brand) => {
|
|
469
|
-
const result = normalizePastBrandResult(brand.result_label);
|
|
470
|
-
return (
|
|
471
|
-
<li key={brand.id}>
|
|
472
|
-
{result == null ? brand.name : `${brand.name}, ${result}`}
|
|
473
|
-
</li>
|
|
474
|
-
);
|
|
475
|
-
})}
|
|
476
|
-
</ul>
|
|
477
|
-
<div className="group overflow-hidden" aria-hidden>
|
|
478
|
-
<div
|
|
479
|
-
className="marquee-track flex w-max items-center"
|
|
480
|
-
style={{ "--marquee-duration": `${duration}s` } as CSSProperties}
|
|
481
|
-
>
|
|
482
|
-
<ul className="flex min-w-0 items-center gap-3">
|
|
483
|
-
{brands.map((brand) => (
|
|
484
|
-
<li key={`${brand.id}-loop-a`}>
|
|
485
|
-
<PastBrandCard brand={brand} className="w-max max-w-full shrink-0" />
|
|
486
|
-
</li>
|
|
487
|
-
))}
|
|
488
|
-
</ul>
|
|
489
|
-
<ul className="flex min-w-0 items-center gap-3">
|
|
490
|
-
{brands.map((brand) => (
|
|
491
|
-
<li key={`${brand.id}-loop-b`}>
|
|
492
|
-
<PastBrandCard brand={brand} className="w-max max-w-full shrink-0" />
|
|
493
|
-
</li>
|
|
494
|
-
))}
|
|
495
|
-
</ul>
|
|
496
|
-
</div>
|
|
497
|
-
</div>
|
|
498
|
-
</>
|
|
499
|
-
) : (
|
|
500
|
-
<ul className="flex min-w-0 items-center gap-3" aria-label="Past brands">
|
|
501
|
-
{brands.map((brand) => (
|
|
502
|
-
<li key={brand.id}>
|
|
503
|
-
<PastBrandCard brand={brand} className="w-max max-w-full shrink-0" />
|
|
504
|
-
</li>
|
|
505
|
-
))}
|
|
506
|
-
</ul>
|
|
507
|
-
)}
|
|
508
|
-
</div>
|
|
509
|
-
);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
export function PublicPastBrands({ brands }: { brands: readonly PitchKitPastBrand[] }) {
|
|
513
|
-
if (brands.length === 0) return null;
|
|
514
|
-
|
|
515
|
-
return (
|
|
516
|
-
<section className="band min-w-0 gap-y-4">
|
|
517
|
-
<div className="col-span-full flex flex-wrap items-end justify-between gap-3">
|
|
518
|
-
<h2 className={cardTitleClasses}>Past brands</h2>
|
|
519
|
-
</div>
|
|
520
|
-
<PastBrandsRail brands={brands} />
|
|
521
|
-
</section>
|
|
522
|
-
);
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
interface OwnerPitchKitProps extends PitchKitPageData {
|
|
527
|
-
reachState?: PitchKitReachState;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
function pitchKitIntroIsEmpty(intro: string) {
|
|
531
|
-
return intro.trim().length === 0;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
function PublicIntro({ intro }: { intro: string }) {
|
|
535
|
-
if (pitchKitIntroIsEmpty(intro)) return null;
|
|
536
|
-
return <p className="type-body text-fg text-fg">{intro}</p>;
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
function OwnerReachCard({
|
|
540
|
-
reachState,
|
|
541
|
-
reachData,
|
|
542
|
-
}: {
|
|
543
|
-
reachState: PitchKitReachState;
|
|
544
|
-
reachData: ChartCartesianPoint[];
|
|
545
|
-
}) {
|
|
546
|
-
return (
|
|
547
|
-
<Card
|
|
548
|
-
variant="outlined"
|
|
549
|
-
shape="rounded"
|
|
550
|
-
bodyTerminal
|
|
551
|
-
className="col-span-full min-w-0"
|
|
552
|
-
>
|
|
553
|
-
<Card.Header
|
|
554
|
-
start={
|
|
555
|
-
<>
|
|
556
|
-
<h2 className={cardTitleClasses}>Reach over 30 days</h2>
|
|
557
|
-
<p className={cardSubtitleClasses}>
|
|
558
|
-
Typical performance with unusual spikes left visible.
|
|
559
|
-
</p>
|
|
560
|
-
</>
|
|
561
|
-
}
|
|
562
|
-
end={
|
|
563
|
-
<Badge variant="neutral" emphasis="muted" size="sm">
|
|
564
|
-
Graph data
|
|
565
|
-
</Badge>
|
|
566
|
-
}
|
|
567
|
-
/>
|
|
568
|
-
<Card.Body>
|
|
569
|
-
{reachState === "insufficient" ? (
|
|
570
|
-
<div
|
|
571
|
-
className="flex min-w-0 flex-col gap-4 bg-body px-3.5 py-4 rounded-[var(--radius-card-body)] items-center justify-center text-center"
|
|
572
|
-
style={{ minHeight: 220 }}
|
|
573
|
-
>
|
|
574
|
-
<div className="flex max-w-lg flex-col gap-2 items-center text-center">
|
|
575
|
-
<Badge variant="neutral" emphasis="muted">No data</Badge>
|
|
576
|
-
<h3 className="type-heading-2 text-fg">No reach data yet</h3>
|
|
577
|
-
<p className="type-body text-fg text-muted">
|
|
578
|
-
Connect more Instagram activity to plot the last 30 days.
|
|
579
|
-
</p>
|
|
580
|
-
</div>
|
|
581
|
-
</div>
|
|
582
|
-
) : (
|
|
583
|
-
<div className="flex min-w-0 flex-col gap-4 bg-body px-3.5 py-4 rounded-[var(--radius-card-body)]">
|
|
584
|
-
<Chart.Cartesian
|
|
585
|
-
data={reachData}
|
|
586
|
-
config={reachConfig}
|
|
587
|
-
periodKind="month"
|
|
588
|
-
minHeight={220}
|
|
589
|
-
aria-label="Daily and typical Instagram reach over the last 30 days"
|
|
590
|
-
/>
|
|
591
|
-
<Chart.Legend config={reachConfig} />
|
|
592
|
-
</div>
|
|
593
|
-
)}
|
|
594
|
-
</Card.Body>
|
|
595
|
-
</Card>
|
|
596
|
-
);
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
function OwnerCountries({ countries }: { countries: ChartRankedBarItem[] }) {
|
|
600
|
-
const topCountries = countries.slice(0, 3);
|
|
601
|
-
if (topCountries.length === 0) return null;
|
|
602
|
-
|
|
603
|
-
return (
|
|
604
|
-
<Card
|
|
605
|
-
variant="outlined"
|
|
606
|
-
shape="rounded"
|
|
607
|
-
bodyTerminal
|
|
608
|
-
className="col-span-full min-w-0"
|
|
609
|
-
>
|
|
610
|
-
<Card.Header
|
|
611
|
-
start={
|
|
612
|
-
<>
|
|
613
|
-
<h2 className={cardTitleClasses}>Top countries</h2>
|
|
614
|
-
<p className={cardSubtitleClasses}>
|
|
615
|
-
Top 3 from Instagram Insights.
|
|
616
|
-
</p>
|
|
617
|
-
</>
|
|
618
|
-
}
|
|
619
|
-
/>
|
|
620
|
-
<Card.Body>
|
|
621
|
-
<div className="flex min-w-0 flex-col gap-4 bg-body px-3.5 py-4 rounded-[var(--radius-card-body)]">
|
|
622
|
-
<Chart.RankedBars
|
|
623
|
-
aria-label="Audience by country"
|
|
624
|
-
items={topCountries}
|
|
625
|
-
animate="initial"
|
|
626
|
-
/>
|
|
627
|
-
</div>
|
|
628
|
-
</Card.Body>
|
|
629
|
-
</Card>
|
|
630
|
-
);
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
function OwnerPitchKit({
|
|
634
|
-
identity,
|
|
635
|
-
intro,
|
|
636
|
-
posts,
|
|
637
|
-
contact,
|
|
638
|
-
brands,
|
|
639
|
-
countries,
|
|
640
|
-
reachData,
|
|
641
|
-
reachState = "resolved",
|
|
642
|
-
}: OwnerPitchKitProps) {
|
|
643
|
-
const [visiblePosts, setVisiblePosts] = useState(posts);
|
|
644
|
-
const [postNotice, setPostNotice] = useState<string | null>(null);
|
|
645
|
-
const [pendingHidePostId, setPendingHidePostId] = useState<string | null>(null);
|
|
646
|
-
const engagementRate = reachState === "resolved" ? "5.8%" : null;
|
|
647
|
-
const typicalReach = reachState === "resolved" ? "9.3K" : "—";
|
|
648
|
-
|
|
649
|
-
function handlePostAction(postId: string, actionId: string) {
|
|
650
|
-
if (actionId === "hide") {
|
|
651
|
-
setPendingHidePostId(postId);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
function hidePendingPost() {
|
|
656
|
-
const hiddenPost = visiblePosts.find((post) => post.id === pendingHidePostId);
|
|
657
|
-
if (!hiddenPost) return;
|
|
658
|
-
|
|
659
|
-
setVisiblePosts((current) =>
|
|
660
|
-
current.filter((post) => post.id !== hiddenPost.id),
|
|
661
|
-
);
|
|
662
|
-
setPostNotice("Post hidden from the shareable kit.");
|
|
663
|
-
setPendingHidePostId(null);
|
|
664
|
-
toast.add({
|
|
665
|
-
title: "Post hidden from kit",
|
|
666
|
-
description: "It no longer appears in the shareable PitchKit.",
|
|
667
|
-
duration: 6000,
|
|
668
|
-
action: {
|
|
669
|
-
label: "Undo",
|
|
670
|
-
onClick: () => {
|
|
671
|
-
setVisiblePosts((current) =>
|
|
672
|
-
current.some((post) => post.id === hiddenPost.id)
|
|
673
|
-
? current
|
|
674
|
-
: [...current, hiddenPost],
|
|
675
|
-
);
|
|
676
|
-
setPostNotice("Post restored to the shareable kit.");
|
|
677
|
-
},
|
|
678
|
-
},
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
return (
|
|
683
|
-
<>
|
|
684
|
-
<section className="col-span-full">
|
|
685
|
-
<PageHeader variant="page" title="Your Pitchkit" />
|
|
686
|
-
<div className="flex max-w-2xl flex-col gap-1">
|
|
687
|
-
<p className="type-body text-fg text-muted">Edit what brands see</p>
|
|
688
|
-
</div>
|
|
689
|
-
</section>
|
|
690
|
-
|
|
691
|
-
<section className="col-span-full border-b border-border pb-6">
|
|
692
|
-
<div className="flex min-w-0 flex-col gap-3">
|
|
693
|
-
<CreatorIdentityStrip
|
|
694
|
-
identity={identity}
|
|
695
|
-
nameAs="h1"
|
|
696
|
-
showProfessionalChip
|
|
697
|
-
/>
|
|
698
|
-
<PublicIntro intro={intro} />
|
|
699
|
-
</div>
|
|
700
|
-
</section>
|
|
701
|
-
|
|
702
|
-
<div
|
|
703
|
-
role="group"
|
|
704
|
-
aria-label="Instagram performance summary"
|
|
705
|
-
className="band gap-y-4"
|
|
706
|
-
>
|
|
707
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Followers" value="84.2K" />
|
|
708
|
-
{engagementRate != null ? (
|
|
709
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Engagement rate" value={engagementRate} />
|
|
710
|
-
) : null}
|
|
711
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Typical reach" value={typicalReach} />
|
|
712
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Typical saves" value="6.1K" />
|
|
713
|
-
</div>
|
|
714
|
-
|
|
715
|
-
<div className="band min-w-0 gap-y-6 [align-items:stretch]">
|
|
716
|
-
<OwnerReachCard reachState={reachState} reachData={reachData} />
|
|
717
|
-
<OwnerCountries countries={countries} />
|
|
718
|
-
</div>
|
|
719
|
-
|
|
720
|
-
<section className="band min-w-0 gap-y-4">
|
|
721
|
-
<div className="col-span-full flex flex-wrap items-end justify-between gap-3">
|
|
722
|
-
<div>
|
|
723
|
-
<h2 className={cardTitleClasses}>Selected posts</h2>
|
|
724
|
-
<p className="type-body text-fg text-muted">
|
|
725
|
-
{postNotice ?? "Proof from the current Instagram set."}
|
|
726
|
-
</p>
|
|
727
|
-
</div>
|
|
728
|
-
</div>
|
|
729
|
-
<div className="band col-span-full min-w-0 gap-y-4">
|
|
730
|
-
{visiblePosts.map((post, index) => (
|
|
731
|
-
<Card key={post.id} variant="outlined" shape="rounded" className="col-span-full min-w-0 md:col-span-4 lg:col-span-4">
|
|
732
|
-
<Card.Header
|
|
733
|
-
end={
|
|
734
|
-
<MoreMenu
|
|
735
|
-
aria-label={`Manage selected post ${index + 1}`}
|
|
736
|
-
size="xs"
|
|
737
|
-
items={[
|
|
738
|
-
{
|
|
739
|
-
id: "hide",
|
|
740
|
-
label: "Hide from kit",
|
|
741
|
-
start: (
|
|
742
|
-
<ButtonIcon size="sm">
|
|
743
|
-
<EyeOff />
|
|
744
|
-
</ButtonIcon>
|
|
745
|
-
),
|
|
746
|
-
},
|
|
747
|
-
]}
|
|
748
|
-
onAction={(actionId) => handlePostAction(post.id, actionId)}
|
|
749
|
-
/>
|
|
750
|
-
}
|
|
751
|
-
/>
|
|
752
|
-
<Card.Body>
|
|
753
|
-
<img
|
|
754
|
-
className="aspect-[4/3] w-full bg-body object-cover rounded-[var(--radius-card-body)]"
|
|
755
|
-
src={post.imageUrl}
|
|
756
|
-
alt={post.imageAlt}
|
|
757
|
-
/>
|
|
758
|
-
</Card.Body>
|
|
759
|
-
<Card.Footer>
|
|
760
|
-
<div className="grid w-full grid-cols-2 gap-3">
|
|
761
|
-
{[
|
|
762
|
-
["Likes", post.likes],
|
|
763
|
-
["Comments", post.comments],
|
|
764
|
-
].map(([label, value]) => (
|
|
765
|
-
<span key={label} className="flex min-w-0 flex-col gap-1">
|
|
766
|
-
<span className="type-supporting font-medium uppercase tracking-wider text-muted text-muted">{label}</span>
|
|
767
|
-
<span className="font-mono text-sm tabular-nums text-fg">
|
|
768
|
-
{compactNumber.format(value as number)}
|
|
769
|
-
</span>
|
|
770
|
-
</span>
|
|
771
|
-
))}
|
|
772
|
-
</div>
|
|
773
|
-
</Card.Footer>
|
|
774
|
-
</Card>
|
|
775
|
-
))}
|
|
776
|
-
</div>
|
|
777
|
-
</section>
|
|
778
|
-
|
|
779
|
-
<section className="band min-w-0 gap-y-4">
|
|
780
|
-
<div className="col-span-full flex flex-wrap items-end justify-between gap-3">
|
|
781
|
-
<div>
|
|
782
|
-
<h2 className={cardTitleClasses}>Contact</h2>
|
|
783
|
-
<p className="type-body text-fg text-muted">
|
|
784
|
-
Creator-entered details for brand outreach.
|
|
785
|
-
</p>
|
|
786
|
-
</div>
|
|
787
|
-
</div>
|
|
788
|
-
<Card variant="outlined" padding="md" shape="rounded" className="col-span-full">
|
|
789
|
-
<div className="flex flex-col gap-3">
|
|
790
|
-
<div className="flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between sm:gap-3">
|
|
791
|
-
<span className="type-supporting font-medium uppercase tracking-wider text-muted text-muted">Email</span>
|
|
792
|
-
<TextLink href={`mailto:${contact.email}`}>{contact.email}</TextLink>
|
|
793
|
-
</div>
|
|
794
|
-
<div className="flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between sm:gap-3">
|
|
795
|
-
<span className="type-supporting font-medium uppercase tracking-wider text-muted text-muted">Website</span>
|
|
796
|
-
<TextLink href={contact.websiteHref} external>{contact.websiteLabel}</TextLink>
|
|
797
|
-
</div>
|
|
798
|
-
<div className="flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between sm:gap-3">
|
|
799
|
-
<span className="type-supporting font-medium uppercase tracking-wider text-muted text-muted">Location</span>
|
|
800
|
-
<span className="type-body text-fg text-muted">{contact.location}</span>
|
|
801
|
-
</div>
|
|
802
|
-
</div>
|
|
803
|
-
</Card>
|
|
804
|
-
</section>
|
|
805
|
-
|
|
806
|
-
<PublicPastBrands brands={brands} />
|
|
807
|
-
<AlertDialog
|
|
808
|
-
open={pendingHidePostId != null}
|
|
809
|
-
onOpenChange={(open) => {
|
|
810
|
-
if (!open) setPendingHidePostId(null);
|
|
811
|
-
}}
|
|
812
|
-
title="Hide this post from PitchKit?"
|
|
813
|
-
description="It will no longer appear in the shareable PitchKit. You can add it back later."
|
|
814
|
-
cancelLabel="Keep post"
|
|
815
|
-
confirmLabel="Hide from kit"
|
|
816
|
-
onConfirm={hidePendingPost}
|
|
817
|
-
/>
|
|
818
|
-
</>
|
|
819
|
-
);
|
|
820
|
-
}
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
interface PitchKitInsightsPageProps extends PitchKitPageData {
|
|
824
|
-
audience: PitchKitAudience;
|
|
825
|
-
/** Selected posts on the PitchKit tab; `posts` is the Recent proof set. */
|
|
826
|
-
kitPosts: PitchKitPost[];
|
|
827
|
-
}
|
|
828
|
-
|
|
829
|
-
export function PitchKitInsightsInsufficientReachPage({
|
|
830
|
-
reachData,
|
|
831
|
-
audience,
|
|
832
|
-
posts,
|
|
833
|
-
contact,
|
|
834
|
-
brands,
|
|
835
|
-
identity,
|
|
836
|
-
kitPosts,
|
|
837
|
-
intro,
|
|
838
|
-
countries,
|
|
839
|
-
}: PitchKitInsightsPageProps) {
|
|
840
|
-
const [view, setView] = useState("insights");
|
|
841
|
-
const [proofMetric, setProofMetric] = useState<PitchKitProofMetric>("reach");
|
|
842
|
-
const rankedPosts = [...posts].sort(
|
|
843
|
-
(a, b) =>
|
|
844
|
-
proofMetricValue(b, proofMetric) - proofMetricValue(a, proofMetric),
|
|
845
|
-
);
|
|
846
|
-
|
|
847
|
-
function handleProofMetricChange(value: string) {
|
|
848
|
-
setProofMetric(value as PitchKitProofMetric);
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
return (
|
|
852
|
-
<main className="grid-page min-h-screen bg-body [--grid-column-gap:8px] [--grid-max:1140px] [padding-bottom:44px]">
|
|
853
|
-
|
|
854
|
-
<div className="band pb-4">
|
|
855
|
-
<header className="col-span-full grid grid-cols-[1fr_auto_1fr] items-center gap-3">
|
|
856
|
-
<span className="type-heading-4 text-fg text-fg">PitchKit</span>
|
|
857
|
-
<SegmentedControl
|
|
858
|
-
aria-label="PitchKit primary navigation"
|
|
859
|
-
size="sm"
|
|
860
|
-
value={view}
|
|
861
|
-
onValueChange={setView}
|
|
862
|
-
>
|
|
863
|
-
<SegmentedControl.Item value="insights">Insights</SegmentedControl.Item>
|
|
864
|
-
<SegmentedControl.Item value="pitchkit">PitchKit</SegmentedControl.Item>
|
|
865
|
-
</SegmentedControl>
|
|
866
|
-
<span className="justify-self-end">
|
|
867
|
-
<OwnerAccountMenu identity={identity} />
|
|
868
|
-
</span>
|
|
869
|
-
</header>
|
|
870
|
-
</div>
|
|
871
|
-
|
|
872
|
-
<div className="band pt-6 sm:pt-8">
|
|
873
|
-
<div className="band min-w-0 gap-y-6 sm:gap-y-8">
|
|
874
|
-
{view === "pitchkit" ? (
|
|
875
|
-
<OwnerPitchKit identity={identity} intro={intro} posts={kitPosts} contact={contact} brands={brands} countries={countries} reachData={reachData} />
|
|
876
|
-
) : (
|
|
877
|
-
<>
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
<section className="col-span-full">
|
|
881
|
-
<PageHeader variant="page" title="Insights" />
|
|
882
|
-
<div className="flex max-w-2xl flex-col gap-1">
|
|
883
|
-
<p className="type-body text-fg text-muted">
|
|
884
|
-
Verified Instagram performance, refreshed Sep 7 at 12:42 PM.
|
|
885
|
-
</p>
|
|
886
|
-
<p className="type-supporting text-muted text-muted">
|
|
887
|
-
Engagement rate = (likes + comments) ÷ followers.
|
|
888
|
-
</p>
|
|
889
|
-
</div>
|
|
890
|
-
</section>
|
|
891
|
-
|
|
892
|
-
<div className="band gap-y-2">
|
|
893
|
-
|
|
894
|
-
<div
|
|
895
|
-
role="group"
|
|
896
|
-
aria-label="Instagram performance summary"
|
|
897
|
-
className="band gap-y-4"
|
|
898
|
-
>
|
|
899
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Followers" value="84.2K" trend={{ value: "+2.4%", direction: "up" }} />
|
|
900
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Engagement rate" value="5.8%" />
|
|
901
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Typical reach" value="9.3K" />
|
|
902
|
-
<Stat className="col-span-2 md:col-span-4 lg:col-span-3" label="Saves" value="6.1K" trend={{ value: "+8.1%", direction: "up" }} />
|
|
903
|
-
</div>
|
|
904
|
-
|
|
905
|
-
<div className="band min-w-0 gap-y-6 [align-items:stretch]">
|
|
906
|
-
<Card variant="outlined" shape="rounded" bodyTerminal className="col-span-full min-w-0 lg:col-span-6">
|
|
907
|
-
<Card.Header
|
|
908
|
-
start={
|
|
909
|
-
<>
|
|
910
|
-
<h2 className={cardTitleClasses}>Reach over 30 days</h2>
|
|
911
|
-
<p className={cardSubtitleClasses}>
|
|
912
|
-
Typical performance with unusual spikes left visible.
|
|
913
|
-
</p>
|
|
914
|
-
</>
|
|
915
|
-
}
|
|
916
|
-
end={
|
|
917
|
-
<Badge variant="neutral" emphasis="muted" size="sm">
|
|
918
|
-
Graph data
|
|
919
|
-
</Badge>
|
|
920
|
-
}
|
|
921
|
-
/>
|
|
922
|
-
<Card.Body>
|
|
923
|
-
<div
|
|
924
|
-
className="flex min-w-0 flex-col gap-4 bg-body px-3.5 py-4 rounded-[var(--radius-card-body)] items-center justify-center text-center"
|
|
925
|
-
style={{ minHeight: 344 }}
|
|
926
|
-
>
|
|
927
|
-
<div className="flex max-w-lg flex-col gap-2 items-center text-center">
|
|
928
|
-
<Badge variant="neutral" emphasis="muted">No data</Badge>
|
|
929
|
-
<h3 className="type-heading-2 text-fg">No reach data yet</h3>
|
|
930
|
-
<p className="type-body text-fg text-muted">
|
|
931
|
-
Connect more Instagram activity to plot the last 30 days.
|
|
932
|
-
</p>
|
|
933
|
-
</div>
|
|
934
|
-
</div>
|
|
935
|
-
</Card.Body>
|
|
936
|
-
</Card>
|
|
937
|
-
|
|
938
|
-
<Card variant="outlined" shape="rounded" bodyTerminal className="col-span-full min-w-0 lg:col-span-6">
|
|
939
|
-
<Card.Header
|
|
940
|
-
start={
|
|
941
|
-
<>
|
|
942
|
-
<h2 className={cardTitleClasses}>Audience fit</h2>
|
|
943
|
-
<p className={cardSubtitleClasses}>Ranked Instagram percentages.</p>
|
|
944
|
-
</>
|
|
945
|
-
}
|
|
946
|
-
/>
|
|
947
|
-
<Card.Body>
|
|
948
|
-
<div className="grid min-w-0 gap-y-6 bg-body px-3.5 py-4 [column-gap:var(--grid-column-gap)] sm:grid-cols-2 rounded-[var(--radius-card-body)]">
|
|
949
|
-
<AudienceSection title="Countries" items={audience.countries} />
|
|
950
|
-
<AudienceSection title="Cities" items={audience.cities} />
|
|
951
|
-
<AudienceSection title="Age" items={audience.ages} />
|
|
952
|
-
<AudienceSection title="Gender" items={audience.gender} />
|
|
953
|
-
</div>
|
|
954
|
-
</Card.Body>
|
|
955
|
-
</Card>
|
|
956
|
-
</div>
|
|
957
|
-
</div>
|
|
958
|
-
|
|
959
|
-
<section className="band min-w-0 gap-y-4">
|
|
960
|
-
<div className="col-span-full flex flex-wrap items-end justify-between gap-3">
|
|
961
|
-
<div>
|
|
962
|
-
<h2 className={cardTitleClasses}>Recent proof</h2>
|
|
963
|
-
<p className="type-body text-fg text-muted">
|
|
964
|
-
{proofMetricNotices[proofMetric]}
|
|
965
|
-
</p>
|
|
966
|
-
</div>
|
|
967
|
-
<Badge variant="neutral" emphasis="muted" size="sm">
|
|
968
|
-
{rankedPosts.length} shown
|
|
969
|
-
</Badge>
|
|
970
|
-
</div>
|
|
971
|
-
<Tab.Group
|
|
972
|
-
aria-label="Rank recent proof posts by"
|
|
973
|
-
value={proofMetric}
|
|
974
|
-
onValueChange={handleProofMetricChange}
|
|
975
|
-
className="col-span-full"
|
|
976
|
-
>
|
|
977
|
-
<Tab value="reach" panelId="recent-proof-panel">Reach</Tab>
|
|
978
|
-
<Tab value="engagement" panelId="recent-proof-panel">Engagement</Tab>
|
|
979
|
-
<Tab value="saves" panelId="recent-proof-panel">Saves</Tab>
|
|
980
|
-
</Tab.Group>
|
|
981
|
-
<div
|
|
982
|
-
id="recent-proof-panel"
|
|
983
|
-
role="tabpanel"
|
|
984
|
-
className="band col-span-full min-w-0 gap-y-4"
|
|
985
|
-
>
|
|
986
|
-
{rankedPosts.map((post, index) => (
|
|
987
|
-
<Card key={post.id} variant="outlined" shape="rounded" className="col-span-full min-w-0 md:col-span-4 lg:col-span-4">
|
|
988
|
-
<Card.Header
|
|
989
|
-
start={
|
|
990
|
-
<span className="flex items-center gap-2">
|
|
991
|
-
<Badge size="sm">#{index + 1}</Badge>
|
|
992
|
-
<span className={cardSubtitleClasses}>{post.publishedAt}</span>
|
|
993
|
-
</span>
|
|
994
|
-
}
|
|
995
|
-
/>
|
|
996
|
-
<Card.Body>
|
|
997
|
-
<img
|
|
998
|
-
className="aspect-[4/3] w-full bg-body object-cover rounded-[var(--radius-card-body)]"
|
|
999
|
-
src={post.imageUrl}
|
|
1000
|
-
alt={post.imageAlt}
|
|
1001
|
-
/>
|
|
1002
|
-
</Card.Body>
|
|
1003
|
-
<Card.Footer>
|
|
1004
|
-
<div className="grid w-full grid-cols-3 gap-3">
|
|
1005
|
-
{[
|
|
1006
|
-
["Saves", post.saves],
|
|
1007
|
-
["Reach", post.reach],
|
|
1008
|
-
["Likes", post.likes],
|
|
1009
|
-
].map(([label, value]) => (
|
|
1010
|
-
<span key={label} className="flex min-w-0 flex-col gap-1">
|
|
1011
|
-
<span className="type-supporting font-medium uppercase tracking-wider text-muted text-muted">{label}</span>
|
|
1012
|
-
<span className="font-mono text-sm tabular-nums text-fg">
|
|
1013
|
-
{compactNumber.format(value as number)}
|
|
1014
|
-
</span>
|
|
1015
|
-
</span>
|
|
1016
|
-
))}
|
|
1017
|
-
</div>
|
|
1018
|
-
</Card.Footer>
|
|
1019
|
-
</Card>
|
|
1020
|
-
))}
|
|
1021
|
-
</div>
|
|
1022
|
-
</section>
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
</>
|
|
1026
|
-
)}
|
|
1027
|
-
</div>
|
|
1028
|
-
</div>
|
|
1029
|
-
<PitchKitPageFooter />
|
|
1030
|
-
<Toaster position="bottom-right" />
|
|
1031
|
-
</main>
|
|
1032
|
-
);
|
|
1033
|
-
}
|