Skip to content

Commit 0cddd59

Browse files
vid277skeptrunedev
authored andcommitted
cleanup: rename policy settings to extra information in dashboard
1 parent 162cbbc commit 0cddd59

File tree

2 files changed

+73
-61
lines changed

2 files changed

+73
-61
lines changed

clients/trieve-shopify-extension/app/components/settings/PolicySettings.tsx

Lines changed: 69 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ResourceItem,
1212
ButtonGroup,
1313
Modal,
14+
InlineGrid,
1415
} from "@shopify/polaris";
1516
import { useState, useCallback } from "react";
1617
import { Dataset } from "trieve-ts-sdk";
@@ -246,64 +247,75 @@ export function PolicySettings({
246247
);
247248

248249
return (
249-
<Card>
250-
<BlockStack gap="400">
251-
<BlockStack gap="200">
252-
<Text variant="headingMd" as="h1">
253-
Store Policies
254-
</Text>
255-
<Text variant="bodyMd" as="p">
256-
Add policies to answer specific questions regarding your store.
257-
</Text>
258-
</BlockStack>
259-
260-
{policies.length > 0 ? (
261-
<ResourceList
262-
resourceName={{ singular: "policy", plural: "policies" }}
263-
items={policies}
264-
renderItem={renderItem}
265-
/>
266-
) : (
267-
!isAdding && emptyStateMarkup
268-
)}
269-
270-
{isAdding && (
271-
<Box paddingBlockStart="400" paddingBlockEnd="400">
272-
<Card>
273-
<BlockStack gap="400">
274-
<TextField
275-
label="Policy Content"
276-
value={newPolicy.content}
277-
onChange={(value) =>
278-
setNewPolicy((prev) => ({ ...prev, content: value }))
279-
}
280-
multiline={4}
281-
autoComplete="off"
282-
/>
283-
<InlineStack gap="400">
284-
<Button variant="primary" onClick={handlePolicyChange}>
285-
Save Policy
286-
</Button>
287-
<Button onClick={handleCancel}>Cancel</Button>
288-
</InlineStack>
289-
</BlockStack>
290-
</Card>
250+
<Box paddingInline="400">
251+
<BlockStack gap={{ xs: "800", sm: "400" }}>
252+
<InlineGrid columns={{ xs: "1fr", md: "2fr 5fr" }} gap="400">
253+
<Box
254+
as="section"
255+
paddingInlineStart={{ xs: "400", sm: "0" }}
256+
paddingInlineEnd={{ xs: "400", sm: "0" }}
257+
>
258+
<BlockStack gap="400">
259+
<Text as="h3" variant="headingMd">
260+
Store Policies
261+
</Text>
262+
<Text as="p" variant="bodyMd">
263+
Add extra information to help tailor chat responses to your store's
264+
specific polices.
265+
</Text>
266+
</BlockStack>
291267
</Box>
292-
)}
268+
<Card>
269+
<BlockStack gap="400">
270+
{policies.length > 0 ? (
271+
<ResourceList
272+
resourceName={{ singular: "policy", plural: "policies" }}
273+
items={policies}
274+
renderItem={renderItem}
275+
/>
276+
) : (
277+
!isAdding && emptyStateMarkup
278+
)}
293279

294-
{!isAdding && !editingPolicyId && policies.length > 0 && (
295-
<InlineStack align="end">
296-
<ButtonGroup>
297-
<Button
298-
onClick={handleStartAdding}
299-
variant="primary"
300-
icon={PlusIcon}
301-
>
302-
Add Policy
303-
</Button>
304-
</ButtonGroup>
305-
</InlineStack>
306-
)}
280+
{isAdding && (
281+
<Box paddingBlockStart="400" paddingBlockEnd="400">
282+
<Card>
283+
<BlockStack gap="400">
284+
<TextField
285+
label="Policy Content"
286+
value={newPolicy.content}
287+
onChange={(value) =>
288+
setNewPolicy((prev) => ({ ...prev, content: value }))
289+
}
290+
multiline={4}
291+
autoComplete="off"
292+
/>
293+
<InlineStack gap="400">
294+
<Button variant="primary" onClick={handlePolicyChange}>
295+
Save Policy
296+
</Button>
297+
<Button onClick={handleCancel}>Cancel</Button>
298+
</InlineStack>
299+
</BlockStack>
300+
</Card>
301+
</Box>
302+
)}
303+
{!isAdding && !editingPolicyId && policies.length > 0 && (
304+
<InlineStack align="end">
305+
<ButtonGroup>
306+
<Button
307+
onClick={handleStartAdding}
308+
variant="primary"
309+
icon={PlusIcon}
310+
>
311+
Add Policy
312+
</Button>
313+
</ButtonGroup>
314+
</InlineStack>
315+
)}
316+
</BlockStack>
317+
</Card>
318+
</InlineGrid>
307319
</BlockStack>
308320

309321
<Modal
@@ -328,6 +340,6 @@ export function PolicySettings({
328340
</BlockStack>
329341
</Modal.Section>
330342
</Modal>
331-
</Card>
343+
</Box>
332344
);
333345
}

clients/trieve-shopify-extension/app/routes/app._dashboard.settings.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ export default function Dataset() {
302302
panelID: "dataset-settings-content",
303303
},
304304
{
305-
id: "policy-settings",
306-
content: "Update Policies",
307-
accessibilityLabel: "Update Policies",
305+
id: "extra-information",
306+
content: "Extra Information",
307+
accessibilityLabel: "Extra Information",
308308
panelID: "update-policies-settings-content",
309309
},
310310
];
@@ -331,7 +331,7 @@ export default function Dataset() {
331331
"preset-questions": <PresetQuestions initialQuestions={presetQuestions} />,
332332
"filter-settings": <FilterSettings />,
333333
"integrations-settings": <IntegrationsSettings />,
334-
"policy-settings": <PolicySettings shopDataset={shopDataset as Dataset} />,
334+
"extra-information": <PolicySettings shopDataset={shopDataset as Dataset} />,
335335
};
336336

337337
return (

0 commit comments

Comments
 (0)