betterstart-cli 0.0.8 → 0.0.10

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.
@@ -210,7 +210,7 @@ export function MediaPageContent() {
210
210
  }
211
211
  />
212
212
 
213
- <main className="space-y-3 px-4 pb-4 h-full">
213
+ <main className="space-y-3 px-4 pb-4 flex-1">
214
214
  <div className="flex w-full flex-col gap-4 pt-px">
215
215
  {activeTab === 'url' ? (
216
216
  <MediaUrlImporter
@@ -67,7 +67,7 @@ export function ContentEditor({
67
67
  return (
68
68
  <Card
69
69
  className={cn(
70
- 'content-editor-wrapper relative flex min-h-60 max-h-[90vh]',
70
+ 'content-editor-wrapper relative flex min-h-60',
71
71
  { 'opacity-50': disabled },
72
72
  className
73
73
  )}
package/dist/cli.js CHANGED
@@ -13530,8 +13530,10 @@ ${cardJSX}
13530
13530
  cards.push(options2.conditionalTabs ? wrapSidebarCardForTab(cardJSX, entry.tabName) : cardJSX);
13531
13531
  }
13532
13532
  flushDefaultCardFields();
13533
- const columnClassName = options2.scrollable ? "relative h-fit max-h-full space-y-4 overflow-y-auto pb-4 lg:sticky lg:top-0" : "lg:sticky lg:top-17 space-y-4 pb-4";
13534
- return ` <div className="${columnClassName}">
13533
+ const columnClassName = options2.scrollable ? 'className="relative h-fit max-h-full space-y-4 overflow-y-auto pb-4 lg:sticky lg:top-0"' : showMetadataWidget ? `className={initialData?.id != null
13534
+ ? 'lg:sticky lg:top-32 space-y-4 pb-4'
13535
+ : 'lg:sticky lg:top-14 space-y-4 pb-4'}` : 'className="lg:sticky lg:top-14 space-y-4 pb-4"';
13536
+ return ` <div ${columnClassName}>
13535
13537
  ${cards.join("\n")}
13536
13538
  </div>`;
13537
13539
  };
@@ -13854,8 +13856,9 @@ ${sidebarCardJSX}
13854
13856
  "handleErrors"
13855
13857
  ]);
13856
13858
  const hookReturnObject = hookReturnNames.map((name) => ` ${name}`).join(",\n");
13859
+ const contentUsesInitialData = hasDraft || hasSidebarFields && showMetadataWidget || topLevelTabsField && showMetadataWidget;
13857
13860
  const contentStateNames = uniqueNames([
13858
- ...hasDraft || topLevelTabsField && showMetadataWidget ? ["initialData"] : [],
13861
+ ...contentUsesInitialData ? ["initialData"] : [],
13859
13862
  "form",
13860
13863
  ...contentUsesPendingState ? ["isPending"] : [],
13861
13864
  ...hasTabsField ? ["activeTab", "setActiveTab"] : [],
@@ -13869,7 +13872,6 @@ ${sidebarCardJSX}
13869
13872
  ]);
13870
13873
  const contentStateDestructure = contentStateNames.map((name) => ` ${name}`).join(",\n");
13871
13874
  const needsCn = hasRelationship || hasSelectCombobox || shouldGuardSidebarByTab || Boolean(topLevelTabsField && showMetadataWidget);
13872
- const needsReact = mainRelFields.length > 0 || hasNestedList || hasDraft || hasCreatableSelect || staticMultiSelectFields.length > 0;
13873
13875
  const metadataOffsetConst = showMetadataWidget ? "const SCROLL_BORDER_OFFSET = 8;\n\n" : "";
13874
13876
  const tabParserConst = hasTabsField ? `const TAB_VALUES = [${tabNames.map((name) => JSON.stringify(name)).join(", ")}] as const
13875
13877
  const TAB_PARSER = parseAsStringLiteral(TAB_VALUES).withDefault(TAB_VALUES[0])
@@ -13901,7 +13903,8 @@ export type TabValue = (typeof TAB_VALUES)[number]
13901
13903
 
13902
13904
  ` : "";
13903
13905
  const hookContent = `'use client'
13904
- ${needsReact ? "\nimport * as React from 'react'" : ""}
13906
+
13907
+ import * as React from 'react'
13905
13908
  import { standardSchemaResolver } from '@hookform/resolvers/standard-schema'
13906
13909
  import { useMutation, ${hasCreatableSelect ? "useQuery, " : ""}useQueryClient } from '@tanstack/react-query'
13907
13910
  import { useRouter } from 'next/navigation'
@@ -13961,12 +13964,22 @@ ${staticMultiSelectState}` : ""}${hasDraft ? "\n const [submitIntent, setSubmit
13961
13964
 
13962
13965
  const isPending = createMutation.isPending || updateMutation.isPending
13963
13966
 
13967
+ const defaultValues: FormValues = {
13968
+ ${defaultValues}
13969
+ }
13970
+
13964
13971
  const form = useForm<FormValues>({
13965
13972
  resolver: standardSchemaResolver(formSchema),
13966
- defaultValues: {
13967
- ${defaultValues}
13968
- }
13973
+ defaultValues
13969
13974
  })
13975
+ const defaultValuesRef = React.useRef(defaultValues)
13976
+ defaultValuesRef.current = defaultValues
13977
+ React.useEffect(
13978
+ () => () => {
13979
+ form.reset(defaultValuesRef.current)
13980
+ },
13981
+ [form]
13982
+ )
13970
13983
  const { isDirty } = form.formState
13971
13984
  ${hasDraft ? " const canPublishPristineDraft = Boolean(initialData && !initialData.published)\n const canSubmitDraftAction = Boolean(initialData?.published || isDirty)\n const canSubmitPublishAction = isDirty || canPublishPristineDraft\n" : ""}
13972
13985
  ${defaultValueFromSyncFunctions ? `
@@ -22826,6 +22839,12 @@ var TEMPLATE_REGISTRY = {
22826
22839
  content: () => readTemplate("lib/actions/auth/middleware.ts"),
22827
22840
  dependencies: ["auth-roles-utils"]
22828
22841
  },
22842
+ "admin-layout": {
22843
+ relPath: "app/(admin)/admin/layout.tsx",
22844
+ content: () => readTemplate("pages/admin-layout.tsx"),
22845
+ base: "cwd",
22846
+ dependencies: ["admin-globals", "admin-providers", "cn"]
22847
+ },
22829
22848
  "auth-layout": {
22830
22849
  relPath: "app/(admin)/admin/(authenticated)/layout.tsx",
22831
22850
  content: () => readTemplate("pages/authenticated-layout.tsx"),