Skip to content

Commit 0e91c9a

Browse files
authored
Allow all lists to be public (#259)
* Add setting to allow public lists * allow setting list to public * update pages to support public lists in wishlist mode * return public value and fix create
1 parent 681ff3d commit 0e91c9a

File tree

24 files changed

+188
-64
lines changed

24 files changed

+188
-64
lines changed

src/ambient.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ type Config = {
6565
};
6666
defaultGroup?: string | null;
6767
enableDefaultListCreation: boolean;
68+
allowPublicLists: boolean;
6869
};
6970

7071
type Option = {

src/app.postcss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ label:not(.unstyled) {
118118
@apply space-y-2;
119119
}
120120

121+
input[type="checkbox"] {
122+
@apply disabled:checked:bg-surface-400-500-token disabled:cursor-not-allowed;
123+
}
124+
121125
/*! purgecss start ignore */
122126
.ptr--icon,
123127
.ptr--text {

src/i18n/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
"add-remove-manager-title": "{isManager, select, true {Add} other {Remove}} Manager",
3232
"admin": "Admin",
3333
"administration": "Administration",
34+
"allow-public-lists": "Allow Public Lists",
35+
"allow-public-lists-tooltip": "Allow users to make a list public. Has no effect if the group is in 'Registry' mode.",
3436
"build": "Build: <a href=\"https://github.com/cmintey/wishlist/commit/{sha}\">{sha}</a>",
3537
"build-date": "Build Date: {buildDate}",
3638
"claims": "Claims",
@@ -49,7 +51,7 @@
4951
"group-settings": "Group Settings",
5052
"groups": "Groups",
5153
"id-field": "User Id: {id}",
52-
"list-creation": "List Creation",
54+
"list-creation": "List Settings",
5355
"make-admin": "Make Admin",
5456
"manager": "Manager",
5557
"members": "Members",
@@ -177,6 +179,7 @@
177179
"price-must-have-a-currency": "Price must have a currency",
178180
"product-information-not-available": "Product information not available",
179181
"public-list-not-found": "Public list not found",
182+
"public-lists-not-allowed": "Public lists are not allowed in this group",
180183
"reset-token-not-found": "Reset token not found",
181184
"something-went-wrong": "Something went wrong",
182185
"suggestions-are-disabled": "Suggestions are disabled",
@@ -331,6 +334,7 @@
331334
"price": "Price",
332335
"price-high-to-low": "Price: High to Low",
333336
"price-low-to-high": "Price: Low to High",
337+
"public": "Public",
334338
"public-url": "Public URL",
335339
"purchased": "Purchased",
336340
"reorder": "Reorder",

src/lib/components/admin/SettingsForm/Claims.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</script>
1111

1212
<BaseSetting title={$t("admin.claims")}>
13-
<label class="unstyled flex flex-row space-x-2">
13+
<label class="unstyled flex flex-row items-center space-x-2">
1414
<input id="claimsShowName" name="claimsShowName" class="checkbox" type="checkbox" bind:checked={enabled} />
1515
<span>{$t("admin.show-name")}</span>
1616
</label>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<script lang="ts">
2+
import BaseSetting from "./BaseSetting.svelte";
3+
import { t } from "svelte-i18n";
4+
5+
interface Props {
6+
creationEnabled: boolean;
7+
allowPublic: boolean;
8+
listMode: ListMode;
9+
}
10+
11+
let { creationEnabled = $bindable(), allowPublic = $bindable(), listMode }: Props = $props();
12+
</script>
13+
14+
<BaseSetting title={$t("admin.list-creation")}>
15+
<span>{$t("admin.enable-default-list-creation-tooltip")}</span>
16+
<label class="unstyled flex flex-row items-center space-x-2">
17+
<input
18+
id="enableDefaultListCreation"
19+
name="enableDefaultListCreation"
20+
class="checkbox"
21+
type="checkbox"
22+
bind:checked={creationEnabled}
23+
/>
24+
<span>{$t("admin.enable-default-list-creation")}</span>
25+
</label>
26+
27+
<span>{$t("admin.allow-public-lists-tooltip")}</span>
28+
<label class="unstyled flex flex-row items-center space-x-2">
29+
<input
30+
id="allowPublicLists"
31+
name="allowPublicLists"
32+
class="checkbox"
33+
class:disabled={listMode === "registry"}
34+
checked={allowPublic || listMode === "registry"}
35+
disabled={listMode === "registry"}
36+
onchange={(e) => (allowPublic = e.currentTarget.checked)}
37+
type="checkbox"
38+
/>
39+
<span>{$t("admin.allow-public-lists")}</span>
40+
</label>
41+
</BaseSetting>

src/lib/components/admin/SettingsForm/PublicSignup.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</script>
1212

1313
<BaseSetting title={$t("admin.public-signup")}>
14-
<label class="unstyled flex flex-row space-x-2">
14+
<label class="unstyled flex flex-row items-center space-x-2">
1515
<input id="enableSignup" name="enableSignup" class="checkbox" type="checkbox" bind:checked={enabled} />
1616
<span>{$t("general.enable")}</span>
1717
</label>

src/lib/components/admin/SettingsForm/SMTP.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</script>
2626

2727
<BaseSetting title={$t("admin.smtp")}>
28-
<label class="unstyled flex flex-row space-x-2">
28+
<label class="unstyled flex flex-row items-center space-x-2">
2929
<input id="enableSMTP" name="enableSMTP" class="checkbox" type="checkbox" bind:checked={enabled} />
3030
<span>{$t("general.enable")}</span>
3131
</label>

src/lib/components/admin/SettingsForm/Suggestions.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</script>
1212

1313
<BaseSetting title={$t("admin.suggestions")}>
14-
<label class="unstyled flex flex-row space-x-2">
14+
<label class="unstyled flex flex-row items-center space-x-2">
1515
<input
1616
id="enableSuggestions"
1717
name="enableSuggestions"

src/lib/components/admin/SettingsForm/index.svelte

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import DefaultGroup from "./DefaultGroup.svelte";
99
import Smtp from "./SMTP.svelte";
1010
import { t } from "svelte-i18n";
11+
import List from "./List.svelte";
1112
1213
type Group = {
1314
id: string;
@@ -52,6 +53,13 @@
5253
<div class="col-span-1">
5354
<DefaultGroup {groups} bind:groupId={config.defaultGroup} />
5455
</div>
56+
<div class="col-span-1">
57+
<List
58+
listMode={config.listMode}
59+
bind:creationEnabled={config.enableDefaultListCreation}
60+
bind:allowPublic={config.allowPublicLists}
61+
/>
62+
</div>
5563

5664
<div class="col-span-1 md:col-span-2">
5765
<Smtp

src/lib/components/wishlists/ItemForm.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
<input
274274
id={list.id}
275275
name="list"
276-
class="checkbox disabled:checked:bg-surface-400-500-token disabled:cursor-not-allowed"
276+
class="checkbox"
277277
checked={listsHavingItem[list.id] !== undefined}
278278
disabled={listsHavingItem[list.id] === false}
279279
type="checkbox"

0 commit comments

Comments
 (0)