@powerhousedao/design-system 6.2.3-dev.81 → 6.2.3-dev.83
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/dist/connect/index.d.ts +2 -0
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +4 -3
- package/dist/connect/index.js.map +1 -1
- package/dist/{drive-settings-form.impl-Dthjyouk.js → drive-settings-form.impl-yV9u4h5c.js} +3 -2
- package/dist/drive-settings-form.impl-yV9u4h5c.js.map +1 -0
- package/package.json +4 -4
- package/dist/drive-settings-form.impl-Dthjyouk.js.map +0 -1
|
@@ -71,7 +71,7 @@ function SharingTypeFormInput(props) {
|
|
|
71
71
|
//#endregion
|
|
72
72
|
//#region src/connect/components/form/drive-settings-form.impl.tsx
|
|
73
73
|
function DriveSettingsForm(props) {
|
|
74
|
-
const { drive, sharingType, availableOffline, systemInfo, onSubmit, handleDeleteDrive } = props;
|
|
74
|
+
const { drive, sharingType, availableOffline, systemInfo, onSubmit, handleDeleteDrive, children } = props;
|
|
75
75
|
const name = drive.header.name;
|
|
76
76
|
const [showLocationSettings, setShowLocationSettings] = useState(false);
|
|
77
77
|
const [showAbout, setShowAbout] = useState(false);
|
|
@@ -103,6 +103,7 @@ function DriveSettingsForm(props) {
|
|
|
103
103
|
title: "Location",
|
|
104
104
|
children: [/* @__PURE__ */ jsx(LocationInfo, { location }), /* @__PURE__ */ jsx(AvailableOfflineToggle, { ...register("availableOffline") })]
|
|
105
105
|
}),
|
|
106
|
+
children ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Divider, { className: "my-3" }), children] }) : null,
|
|
106
107
|
/* @__PURE__ */ jsx(Divider, { className: "my-3" }),
|
|
107
108
|
/* @__PURE__ */ jsxs(Disclosure, {
|
|
108
109
|
isOpen: showAbout,
|
|
@@ -168,4 +169,4 @@ function DriveSettingsForm(props) {
|
|
|
168
169
|
//#endregion
|
|
169
170
|
export { DriveSettingsForm };
|
|
170
171
|
|
|
171
|
-
//# sourceMappingURL=drive-settings-form.impl-
|
|
172
|
+
//# sourceMappingURL=drive-settings-form.impl-yV9u4h5c.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drive-settings-form.impl-yV9u4h5c.js","names":["Icon","forwardRef","FormInput","DriveNameInput","props","ref","icon","Icon","PowerhouseButton","useState","DriveNameInput","DeleteDrive","props","drive","handleDeleteDrive","onCancel","driveNameInput","setDriveNameInput","isAllowedToDelete","header","name","deleteDrive","event","target","value","Controller","ConnectSelect","sharingTypeOptions","SharingTypeFormInput","props","control","delegatedProps","field","Icon","PowerhouseButton","useState","useForm","Disclosure","Divider","AvailableOfflineToggle","DeleteDrive","DriveNameInput","Label","LocationInfo","SharingTypeFormInput","DriveSettingsForm","props","drive","sharingType","availableOffline","systemInfo","onSubmit","handleDeleteDrive","children","name","header","showLocationSettings","setShowLocationSettings","showAbout","setShowAbout","showDangerZone","setShowDangerZone","showDeleteDrive","setShowDeleteDrive","register","handleSubmit","control","mode","defaultValues","location","e","status","version","gitHash"],"sources":["../src/connect/components/form/inputs/drive-name-input.tsx","../src/connect/components/form/inputs/delete-drive.tsx","../src/connect/components/form/inputs/sharing-type-form-input.tsx","../src/connect/components/form/drive-settings-form.impl.tsx"],"sourcesContent":["import { Icon } from \"#design-system\";\nimport type { ComponentPropsWithRef, ForwardedRef } from \"react\";\nimport { forwardRef } from \"react\";\nimport { FormInput } from \"../../form-input/form-input.js\";\n\ntype DriveNameInputProps = Omit<\n ComponentPropsWithRef<typeof FormInput>,\n \"icon\" | \"id\"\n> & {\n readonly icon?: React.JSX.Element;\n};\n\nexport const DriveNameInput = forwardRef(function DriveNameInput(\n props: DriveNameInputProps,\n ref: ForwardedRef<HTMLInputElement>,\n) {\n return (\n <FormInput\n {...props}\n icon={props.icon ?? <Icon name=\"Drive\" />}\n id=\"driveName\"\n placeholder=\"Drive name\"\n ref={ref}\n />\n );\n});\n","import { Icon, PowerhouseButton } from \"#design-system\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { useState } from \"react\";\nimport { DriveNameInput } from \"./drive-name-input.js\";\n\nexport type DeleteDriveProps = {\n drive: DocumentDriveDocument;\n handleDeleteDrive: () => void;\n onCancel: () => void;\n};\n\nexport function DeleteDrive(props: DeleteDriveProps) {\n const { drive, handleDeleteDrive, onCancel } = props;\n const [driveNameInput, setDriveNameInput] = useState(\"\");\n\n const isAllowedToDelete = driveNameInput === drive.header.name;\n\n function deleteDrive() {\n if (isAllowedToDelete) {\n handleDeleteDrive();\n }\n }\n\n return (\n <div>\n <p className=\"mb-2 rounded-md bg-background p-4 text-center text-foreground\">\n Are you sure you want to delete this drive? All files and subfolders\n within it will be removed. Do you want to proceed?\n </p>\n <DriveNameInput\n icon={<Icon name=\"Lock\" />}\n onChange={(event) => setDriveNameInput(event.target.value)}\n placeholder=\"Enter drive name...\"\n value={driveNameInput}\n />\n <div className=\"flex gap-3\">\n <PowerhouseButton className=\"w-full\" color=\"light\" onClick={onCancel}>\n Cancel\n </PowerhouseButton>\n <PowerhouseButton\n className=\"w-full\"\n color=\"red\"\n disabled={!isAllowedToDelete}\n onClick={deleteDrive}\n >\n Delete\n </PowerhouseButton>\n </div>\n </div>\n );\n}\n","import type { SharingType } from \"@powerhousedao/shared/document-drive\";\nimport type { ComponentPropsWithRef } from \"react\";\nimport type { Control, Path } from \"react-hook-form\";\nimport { Controller } from \"react-hook-form\";\nimport { ConnectSelect } from \"../../select/select.js\";\nimport { sharingTypeOptions } from \"../../../constants/options.js\";\n\ntype SharingTypeFormInputProps<T extends { sharingType: SharingType }> = Omit<\n ComponentPropsWithRef<typeof ConnectSelect>,\n \"id\" | \"items\" | \"value\" | \"onChange\"\n> & {\n readonly control: Control<T>;\n};\nexport function SharingTypeFormInput<T extends { sharingType: SharingType }>(\n props: SharingTypeFormInputProps<T>,\n) {\n const { control, ...delegatedProps } = props;\n\n return (\n <Controller\n control={control}\n name={\"sharingType\" as Path<T>}\n render={({ field }) => (\n <ConnectSelect\n {...delegatedProps}\n {...field}\n id=\"sharingType\"\n items={sharingTypeOptions}\n />\n )}\n />\n );\n}\n","import { Icon, PowerhouseButton } from \"#design-system\";\nimport type { DriveSystemInfoState } from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { SharingType } from \"@powerhousedao/shared/document-drive\";\nimport { useState, type ReactNode } from \"react\";\nimport type { SubmitHandler } from \"react-hook-form\";\nimport { useForm } from \"react-hook-form\";\nimport { Disclosure } from \"../disclosure/disclosure.js\";\nimport { Divider } from \"../divider/divider.js\";\nimport { AvailableOfflineToggle } from \"./inputs/available-offline-toggle.js\";\nimport { DeleteDrive } from \"./inputs/delete-drive.js\";\nimport { DriveNameInput } from \"./inputs/drive-name-input.js\";\nimport { Label } from \"./inputs/label.js\";\nimport { LocationInfo } from \"./inputs/location-info.js\";\nimport { SharingTypeFormInput } from \"./inputs/sharing-type-form-input.js\";\n\ntype Inputs = {\n name: string;\n sharingType: SharingType;\n availableOffline: boolean;\n};\n\ntype DriveSettingsFormProps = {\n drive: DocumentDriveDocument;\n sharingType: SharingType;\n availableOffline: boolean;\n systemInfo: DriveSystemInfoState;\n onSubmit: DriveSettingsFormSubmitHandler;\n handleCancel: () => void;\n handleDeleteDrive: () => void;\n /** Rendered after the location settings, e.g. where the drive opens. */\n children?: ReactNode;\n};\n\nexport type DriveSettingsFormSubmitHandler = SubmitHandler<Inputs>;\n\nexport function DriveSettingsForm(props: DriveSettingsFormProps) {\n const {\n drive,\n sharingType,\n availableOffline,\n systemInfo,\n onSubmit,\n handleDeleteDrive,\n children,\n } = props;\n const name = drive.header.name;\n\n const [showLocationSettings, setShowLocationSettings] = useState(false);\n const [showAbout, setShowAbout] = useState(false);\n const [showDangerZone, setShowDangerZone] = useState(false);\n const [showDeleteDrive, setShowDeleteDrive] = useState(false);\n\n const { register, handleSubmit, control } = useForm<Inputs>({\n mode: \"onBlur\",\n defaultValues: {\n name,\n sharingType,\n availableOffline,\n },\n });\n\n const location = sharingType === \"PUBLIC\" ? \"SWITCHBOARD\" : sharingType;\n\n return (\n <form onSubmit={(e) => void handleSubmit(onSubmit)(e)}>\n <DriveNameInput {...register(\"name\")} />\n <Divider className=\"my-4\" />\n <Label htmlFor=\"sharingType\">Sharing settings</Label>\n <SharingTypeFormInput control={control} />\n <Divider className=\"my-3\" />\n <Disclosure\n isOpen={showLocationSettings}\n onOpenChange={() => setShowLocationSettings(!showLocationSettings)}\n title=\"Location\"\n >\n <LocationInfo location={location} />\n <AvailableOfflineToggle {...register(\"availableOffline\")} />\n </Disclosure>\n {children ? (\n <>\n <Divider className=\"my-3\" />\n {children}\n </>\n ) : null}\n <Divider className=\"my-3\" />\n <Disclosure\n isOpen={showAbout}\n onOpenChange={() => setShowAbout(!showAbout)}\n title=\"About this drive\"\n >\n {systemInfo.status === \"local\" && (\n <p className=\"py-2 text-sm text-muted-foreground\">\n Local drive — N/A\n </p>\n )}\n {systemInfo.status === \"loading\" && (\n <p className=\"py-2 text-sm text-muted-foreground\">Loading…</p>\n )}\n {systemInfo.status === \"error\" && (\n <p className=\"py-2 text-sm text-destructive\">\n Could not load system info\n </p>\n )}\n {systemInfo.status === \"ready\" && (\n <div className=\"py-2 text-sm text-foreground\">\n <div>\n <span className=\"font-medium\">Version:</span> {systemInfo.version}\n </div>\n <div>\n <span className=\"font-medium\">Git hash:</span>{\" \"}\n {systemInfo.gitHash}\n </div>\n </div>\n )}\n </Disclosure>\n <Divider className=\"my-3\" />\n <Disclosure\n isOpen={showDangerZone}\n onOpenChange={() => setShowDangerZone(!showDangerZone)}\n title=\"Danger zone\"\n >\n <button\n className=\"flex gap-2 py-3 font-semibold text-destructive transition hover:hover-effect\"\n onClick={() => setShowDeleteDrive(true)}\n type=\"button\"\n >\n <Icon name=\"Trash\" />\n Delete drive\n </button>\n </Disclosure>\n {showDeleteDrive && showDangerZone ? (\n <DeleteDrive\n drive={drive}\n handleDeleteDrive={handleDeleteDrive}\n onCancel={() => setShowDeleteDrive(false)}\n />\n ) : (\n <>\n <Divider className=\"my-3\" />\n <PowerhouseButton className=\"mb-4 w-full\" type=\"submit\">\n Confirm\n </PowerhouseButton>\n </>\n )}\n </form>\n );\n}\n"],"mappings":";;;;;;;;;AAYA,MAAaG,iBAAiBF,yBAAW,SAASE,eAChDC,OACAC,KACA;CACA,OACE,oBAAC,WAAD;EACE,GAAID;EACJ,MAAMA,MAAME,QAAQ,oBAAC,MAAD,EAAM,MAAK,QAAO,CAAA;EACtC,IAAG;EACH,aAAY;EACPD;CAAI,CAAA;AAGf,CAAC;;;ACdD,SAAgBM,YAAYC,OAAyB;CACnD,MAAM,EAAEC,OAAOC,mBAAmBC,aAAaH;CAC/C,MAAM,CAACI,gBAAgBC,qBAAqBR,SAAS,EAAE;CAEvD,MAAMS,oBAAoBF,mBAAmBH,MAAMM,OAAOC;CAE1D,SAASC,cAAc;EACrB,IAAIH,mBACFJ,kBAAkB;CAEtB;CAEA,OACE,qBAAC,OAAD,EAAA,UAAA;EACE,oBAAC,KAAD;GAAG,WAAU;GAA+D,UAAA;EAGzE,CAAA;EACH,oBAAC,gBAAD;GACE,MAAM,oBAAC,MAAD,EAAM,MAAK,OAAM,CAAA;GACvB,WAAWQ,UAAUL,kBAAkBK,MAAMC,OAAOC,KAAK;GACzD,aAAY;GACZ,OAAOR;EAAe,CAAA;EAExB,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACE,oBAAC,kBAAD;IAAkB,WAAU;IAAS,OAAM;IAAQ,SAASD;IAAS,UAAA;GAEnD,CAAA,GAClB,oBAAC,kBAAD;IACE,WAAU;IACV,OAAM;IACN,UAAU,CAACG;IACX,SAASG;IAAY,UAAA;GAGL,CAAA,CACf;;CACF,EAAA,CAAA;AAET;;;ACrCA,SAAgBO,qBACdC,OACA;CACA,MAAM,EAAEC,SAAS,GAAGC,mBAAmBF;CAEvC,OACE,oBAAC,YAAD;EACWC;EAC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K;IAAQ,UAAA;GAErC,CAAA,CACpB,EAAA,CAAA;EAEE;;AAEV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/design-system",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.83",
|
|
4
4
|
"description": "Powerhouse document-engineering design system — GraphQL scalar UI components for building consistent Powerhouse editors.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@babel/core": "^7.29.0",
|
|
77
77
|
"@babel/plugin-transform-react-pure-annotations": "^7.27.1",
|
|
78
78
|
"@babel/preset-typescript": "^7.28.5",
|
|
79
|
-
"@powerhousedao/config": "6.2.3-dev.
|
|
79
|
+
"@powerhousedao/config": "6.2.3-dev.83",
|
|
80
80
|
"@prettier/sync": "^0.5.2",
|
|
81
81
|
"@rollup/plugin-babel": "^7.0.0",
|
|
82
82
|
"@storybook/addon-actions": "^8.6.18",
|
|
@@ -121,8 +121,8 @@
|
|
|
121
121
|
"react-dom": ">=19.0.0"
|
|
122
122
|
},
|
|
123
123
|
"dependencies": {
|
|
124
|
-
"@powerhousedao/reactor-browser": "6.2.3-dev.
|
|
125
|
-
"@powerhousedao/shared": "6.2.3-dev.
|
|
124
|
+
"@powerhousedao/reactor-browser": "6.2.3-dev.83",
|
|
125
|
+
"@powerhousedao/shared": "6.2.3-dev.83",
|
|
126
126
|
"@radix-ui/react-checkbox": "^1.1.2",
|
|
127
127
|
"@radix-ui/react-dialog": "^1.1.2",
|
|
128
128
|
"@radix-ui/react-dropdown-menu": "^2.1.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"drive-settings-form.impl-Dthjyouk.js","names":["Icon","forwardRef","FormInput","DriveNameInput","props","ref","icon","Icon","PowerhouseButton","useState","DriveNameInput","DeleteDrive","props","drive","handleDeleteDrive","onCancel","driveNameInput","setDriveNameInput","isAllowedToDelete","header","name","deleteDrive","event","target","value","Controller","ConnectSelect","sharingTypeOptions","SharingTypeFormInput","props","control","delegatedProps","field","Icon","PowerhouseButton","useState","useForm","Disclosure","Divider","AvailableOfflineToggle","DeleteDrive","DriveNameInput","Label","LocationInfo","SharingTypeFormInput","DriveSettingsForm","props","drive","sharingType","availableOffline","systemInfo","onSubmit","handleDeleteDrive","name","header","showLocationSettings","setShowLocationSettings","showAbout","setShowAbout","showDangerZone","setShowDangerZone","showDeleteDrive","setShowDeleteDrive","register","handleSubmit","control","mode","defaultValues","location","e","status","version","gitHash"],"sources":["../src/connect/components/form/inputs/drive-name-input.tsx","../src/connect/components/form/inputs/delete-drive.tsx","../src/connect/components/form/inputs/sharing-type-form-input.tsx","../src/connect/components/form/drive-settings-form.impl.tsx"],"sourcesContent":["import { Icon } from \"#design-system\";\nimport type { ComponentPropsWithRef, ForwardedRef } from \"react\";\nimport { forwardRef } from \"react\";\nimport { FormInput } from \"../../form-input/form-input.js\";\n\ntype DriveNameInputProps = Omit<\n ComponentPropsWithRef<typeof FormInput>,\n \"icon\" | \"id\"\n> & {\n readonly icon?: React.JSX.Element;\n};\n\nexport const DriveNameInput = forwardRef(function DriveNameInput(\n props: DriveNameInputProps,\n ref: ForwardedRef<HTMLInputElement>,\n) {\n return (\n <FormInput\n {...props}\n icon={props.icon ?? <Icon name=\"Drive\" />}\n id=\"driveName\"\n placeholder=\"Drive name\"\n ref={ref}\n />\n );\n});\n","import { Icon, PowerhouseButton } from \"#design-system\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport { useState } from \"react\";\nimport { DriveNameInput } from \"./drive-name-input.js\";\n\nexport type DeleteDriveProps = {\n drive: DocumentDriveDocument;\n handleDeleteDrive: () => void;\n onCancel: () => void;\n};\n\nexport function DeleteDrive(props: DeleteDriveProps) {\n const { drive, handleDeleteDrive, onCancel } = props;\n const [driveNameInput, setDriveNameInput] = useState(\"\");\n\n const isAllowedToDelete = driveNameInput === drive.header.name;\n\n function deleteDrive() {\n if (isAllowedToDelete) {\n handleDeleteDrive();\n }\n }\n\n return (\n <div>\n <p className=\"mb-2 rounded-md bg-background p-4 text-center text-foreground\">\n Are you sure you want to delete this drive? All files and subfolders\n within it will be removed. Do you want to proceed?\n </p>\n <DriveNameInput\n icon={<Icon name=\"Lock\" />}\n onChange={(event) => setDriveNameInput(event.target.value)}\n placeholder=\"Enter drive name...\"\n value={driveNameInput}\n />\n <div className=\"flex gap-3\">\n <PowerhouseButton className=\"w-full\" color=\"light\" onClick={onCancel}>\n Cancel\n </PowerhouseButton>\n <PowerhouseButton\n className=\"w-full\"\n color=\"red\"\n disabled={!isAllowedToDelete}\n onClick={deleteDrive}\n >\n Delete\n </PowerhouseButton>\n </div>\n </div>\n );\n}\n","import type { SharingType } from \"@powerhousedao/shared/document-drive\";\nimport type { ComponentPropsWithRef } from \"react\";\nimport type { Control, Path } from \"react-hook-form\";\nimport { Controller } from \"react-hook-form\";\nimport { ConnectSelect } from \"../../select/select.js\";\nimport { sharingTypeOptions } from \"../../../constants/options.js\";\n\ntype SharingTypeFormInputProps<T extends { sharingType: SharingType }> = Omit<\n ComponentPropsWithRef<typeof ConnectSelect>,\n \"id\" | \"items\" | \"value\" | \"onChange\"\n> & {\n readonly control: Control<T>;\n};\nexport function SharingTypeFormInput<T extends { sharingType: SharingType }>(\n props: SharingTypeFormInputProps<T>,\n) {\n const { control, ...delegatedProps } = props;\n\n return (\n <Controller\n control={control}\n name={\"sharingType\" as Path<T>}\n render={({ field }) => (\n <ConnectSelect\n {...delegatedProps}\n {...field}\n id=\"sharingType\"\n items={sharingTypeOptions}\n />\n )}\n />\n );\n}\n","import { Icon, PowerhouseButton } from \"#design-system\";\nimport type { DriveSystemInfoState } from \"@powerhousedao/reactor-browser\";\nimport type { DocumentDriveDocument } from \"@powerhousedao/shared/document-drive\";\nimport type { SharingType } from \"@powerhousedao/shared/document-drive\";\nimport { useState } from \"react\";\nimport type { SubmitHandler } from \"react-hook-form\";\nimport { useForm } from \"react-hook-form\";\nimport { Disclosure } from \"../disclosure/disclosure.js\";\nimport { Divider } from \"../divider/divider.js\";\nimport { AvailableOfflineToggle } from \"./inputs/available-offline-toggle.js\";\nimport { DeleteDrive } from \"./inputs/delete-drive.js\";\nimport { DriveNameInput } from \"./inputs/drive-name-input.js\";\nimport { Label } from \"./inputs/label.js\";\nimport { LocationInfo } from \"./inputs/location-info.js\";\nimport { SharingTypeFormInput } from \"./inputs/sharing-type-form-input.js\";\n\ntype Inputs = {\n name: string;\n sharingType: SharingType;\n availableOffline: boolean;\n};\n\ntype DriveSettingsFormProps = {\n drive: DocumentDriveDocument;\n sharingType: SharingType;\n availableOffline: boolean;\n systemInfo: DriveSystemInfoState;\n onSubmit: DriveSettingsFormSubmitHandler;\n handleCancel: () => void;\n handleDeleteDrive: () => void;\n};\n\nexport type DriveSettingsFormSubmitHandler = SubmitHandler<Inputs>;\n\nexport function DriveSettingsForm(props: DriveSettingsFormProps) {\n const {\n drive,\n sharingType,\n availableOffline,\n systemInfo,\n onSubmit,\n handleDeleteDrive,\n } = props;\n const name = drive.header.name;\n\n const [showLocationSettings, setShowLocationSettings] = useState(false);\n const [showAbout, setShowAbout] = useState(false);\n const [showDangerZone, setShowDangerZone] = useState(false);\n const [showDeleteDrive, setShowDeleteDrive] = useState(false);\n\n const { register, handleSubmit, control } = useForm<Inputs>({\n mode: \"onBlur\",\n defaultValues: {\n name,\n sharingType,\n availableOffline,\n },\n });\n\n const location = sharingType === \"PUBLIC\" ? \"SWITCHBOARD\" : sharingType;\n\n return (\n <form onSubmit={(e) => void handleSubmit(onSubmit)(e)}>\n <DriveNameInput {...register(\"name\")} />\n <Divider className=\"my-4\" />\n <Label htmlFor=\"sharingType\">Sharing settings</Label>\n <SharingTypeFormInput control={control} />\n <Divider className=\"my-3\" />\n <Disclosure\n isOpen={showLocationSettings}\n onOpenChange={() => setShowLocationSettings(!showLocationSettings)}\n title=\"Location\"\n >\n <LocationInfo location={location} />\n <AvailableOfflineToggle {...register(\"availableOffline\")} />\n </Disclosure>\n <Divider className=\"my-3\" />\n <Disclosure\n isOpen={showAbout}\n onOpenChange={() => setShowAbout(!showAbout)}\n title=\"About this drive\"\n >\n {systemInfo.status === \"local\" && (\n <p className=\"py-2 text-sm text-muted-foreground\">\n Local drive — N/A\n </p>\n )}\n {systemInfo.status === \"loading\" && (\n <p className=\"py-2 text-sm text-muted-foreground\">Loading…</p>\n )}\n {systemInfo.status === \"error\" && (\n <p className=\"py-2 text-sm text-destructive\">\n Could not load system info\n </p>\n )}\n {systemInfo.status === \"ready\" && (\n <div className=\"py-2 text-sm text-foreground\">\n <div>\n <span className=\"font-medium\">Version:</span> {systemInfo.version}\n </div>\n <div>\n <span className=\"font-medium\">Git hash:</span>{\" \"}\n {systemInfo.gitHash}\n </div>\n </div>\n )}\n </Disclosure>\n <Divider className=\"my-3\" />\n <Disclosure\n isOpen={showDangerZone}\n onOpenChange={() => setShowDangerZone(!showDangerZone)}\n title=\"Danger zone\"\n >\n <button\n className=\"flex gap-2 py-3 font-semibold text-destructive transition hover:hover-effect\"\n onClick={() => setShowDeleteDrive(true)}\n type=\"button\"\n >\n <Icon name=\"Trash\" />\n Delete drive\n </button>\n </Disclosure>\n {showDeleteDrive && showDangerZone ? (\n <DeleteDrive\n drive={drive}\n handleDeleteDrive={handleDeleteDrive}\n onCancel={() => setShowDeleteDrive(false)}\n />\n ) : (\n <>\n <Divider className=\"my-3\" />\n <PowerhouseButton className=\"mb-4 w-full\" type=\"submit\">\n Confirm\n </PowerhouseButton>\n </>\n )}\n </form>\n );\n}\n"],"mappings":";;;;;;;;;AAYA,MAAaG,iBAAiBF,yBAAW,SAASE,eAChDC,OACAC,KACA;CACA,OACE,oBAAC,WAAD;EACE,GAAID;EACJ,MAAMA,MAAME,QAAQ,oBAAC,MAAD,EAAM,MAAK,QAAO,CAAA;EACtC,IAAG;EACH,aAAY;EACPD;CAAI,CAAA;AAGf,CAAC;;;ACdD,SAAgBM,YA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