Update share form defaults to only select overview and events
Some checks are pending
Node.js CI / build (push) Waiting to run

Changed default selected items for new shares from all items to only
overview and events. Also fixed checkbox text size in create form.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mike Cao 2026-01-21 00:19:08 -08:00
parent d47ee6e8e8
commit dd8888cfcf
2 changed files with 8 additions and 11 deletions

View file

@ -24,11 +24,11 @@ export function ShareCreateForm({ websiteId, onSave, onClose }: ShareCreateFormP
const { touch } = useModified(); const { touch } = useModified();
const [isPending, setIsPending] = useState(false); const [isPending, setIsPending] = useState(false);
// Build default values - all enabled by default // Build default values - only overview and events enabled by default
const defaultValues: Record<string, boolean> = {}; const defaultValues: Record<string, boolean> = {};
SHARE_NAV_ITEMS.forEach(section => { SHARE_NAV_ITEMS.forEach(section => {
section.items.forEach(item => { section.items.forEach(item => {
defaultValues[item.id] = true; defaultValues[item.id] = item.id === 'overview' || item.id === 'events';
}); });
}); });
@ -38,7 +38,7 @@ export function ShareCreateForm({ websiteId, onSave, onClose }: ShareCreateFormP
const parameters: Record<string, boolean> = {}; const parameters: Record<string, boolean> = {};
SHARE_NAV_ITEMS.forEach(section => { SHARE_NAV_ITEMS.forEach(section => {
section.items.forEach(item => { section.items.forEach(item => {
parameters[item.id] = data[item.id] ?? true; parameters[item.id] = data[item.id] ?? false;
}); });
}); });
await post(`/websites/${websiteId}/shares`, { parameters }); await post(`/websites/${websiteId}/shares`, { parameters });
@ -61,9 +61,7 @@ export function ShareCreateForm({ websiteId, onSave, onClose }: ShareCreateFormP
<Column gap="1"> <Column gap="1">
{section.items.map(item => ( {section.items.map(item => (
<FormField key={item.id} name={item.id}> <FormField key={item.id} name={item.id}>
<Checkbox> <Checkbox>{formatMessage((labels as any)[item.label])}</Checkbox>
<Text size="1">{formatMessage((labels as any)[item.label])}</Text>
</Checkbox>
</FormField> </FormField>
))} ))}
</Column> </Column>

View file

@ -57,7 +57,7 @@ export function ShareEditForm({
const parameters: Record<string, boolean> = {}; const parameters: Record<string, boolean> = {};
SHARE_NAV_ITEMS.forEach(section => { SHARE_NAV_ITEMS.forEach(section => {
section.items.forEach(item => { section.items.forEach(item => {
parameters[item.id] = data[item.id] ?? true; parameters[item.id] = data[item.id] ?? false;
}); });
}); });
@ -84,7 +84,8 @@ export function ShareEditForm({
const defaultValues: Record<string, boolean> = {}; const defaultValues: Record<string, boolean> = {};
SHARE_NAV_ITEMS.forEach(section => { SHARE_NAV_ITEMS.forEach(section => {
section.items.forEach(item => { section.items.forEach(item => {
defaultValues[item.id] = share?.parameters?.[item.id] ?? true; const defaultSelected = item.id === 'overview' || item.id === 'events';
defaultValues[item.id] = share?.parameters?.[item.id] ?? defaultSelected;
}); });
}); });
@ -97,9 +98,7 @@ export function ShareEditForm({
</Column> </Column>
{SHARE_NAV_ITEMS.map(section => ( {SHARE_NAV_ITEMS.map(section => (
<Column key={section.section} gap="1"> <Column key={section.section} gap="1">
<Text size="2" weight="bold"> <Text weight="bold">{formatMessage((labels as any)[section.section])}</Text>
{formatMessage((labels as any)[section.section])}
</Text>
<Column gap="1"> <Column gap="1">
{section.items.map(item => ( {section.items.map(item => (
<FormField key={item.id} name={item.id}> <FormField key={item.id} name={item.id}>