From 8f96364e1e9dcfc153d9f8b5aff39d6c6b2086c2 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Mon, 12 Feb 2024 09:18:42 -0800
Subject: feat(settings): settings sync category

---
 src/routes/settings/+page.svelte | 154 ++++++++++++++++++++-------------------
 1 file changed, 80 insertions(+), 74 deletions(-)

(limited to 'src/routes/settings/+page.svelte')

diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index 4b0cb91b..f45fa5cd 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -68,80 +68,86 @@
 {#if data.user === undefined}
 	<LogInRestricted />
 {:else}
-	{#if !$settings.settingsSync}
-		<button
-			on:click={() => {
-				$settings.settingsSync = true;
-
-				fetch(root(`/api/configuration?id=${$identity.id}`)).then((response) => {
-					if (response.ok) {
-						response.json().then((data) => {
-							if (data && data.configuration) {
-								$settings = data.configuration;
-
-								addNotification(
-									options({
-										heading: 'Pulled remote configuration'
-									})
-								);
-							} else {
-								fetch(root(`/api/configuration`), {
-									method: 'PUT',
-									body: JSON.stringify($settings)
-								}).then((response) => {
-									if (response.ok)
-										addNotification(
-											options({
-												heading: 'Created remote configuration'
-											})
-										);
-								});
-							}
-						});
-					}
-				});
-			}}
-		>
-			Enable Settings Sync &amp; Pull Remote Configuration
-		</button>
-		<button
-			on:click={() => {
-				$settings.settingsSync = true;
-
-				fetch(root(`/api/configuration`), {
-					method: 'PUT',
-					body: JSON.stringify($settings)
-				}).then((response) => {
-					if (response.ok)
-						addNotification(
-							options({
-								heading: 'Settings Sync',
-								description: 'Pushed local configuration to remote'
-							})
-						);
-				});
-			}}
-		>
-			Enable &amp; Push Local Configuration
-		</button>
-	{:else}
-		<button
-			on:click={() => {
-				$settings.settingsSync = false;
-
-				addNotification(
-					options({
-						heading: 'Settings sync disabled'
-					})
-				);
-			}}
-		>
-			Disable Settings Sync &amp; Keep Local Configuration
-		</button>
-	{/if}
-
-	<p />
-
+	<Category title={$locale().settings.settingsSync.title} id="sync" open={false}>
+		{#if !$settings.settingsSync}
+			<button
+				on:click={() => {
+					$settings.settingsSync = true;
+
+					fetch(root(`/api/configuration?id=${$identity.id}`)).then((response) => {
+						if (response.ok) {
+							response.json().then((data) => {
+								if (data && data.configuration) {
+									$settings = data.configuration;
+
+									addNotification(
+										options({
+											heading: 'Pulled remote configuration'
+										})
+									);
+								} else {
+									fetch(root(`/api/configuration`), {
+										method: 'PUT',
+										body: JSON.stringify($settings)
+									}).then((response) => {
+										if (response.ok)
+											addNotification(
+												options({
+													heading: 'Created remote configuration'
+												})
+											);
+									});
+								}
+							});
+						}
+					});
+				}}
+			>
+				Pull Remote Configuration
+			</button>
+			<SettingHint lineBreak>
+				Enable settings sync and overwrite any local settings with your remote configuration
+			</SettingHint>
+			<p />
+			<button
+				on:click={() => {
+					$settings.settingsSync = true;
+
+					fetch(root(`/api/configuration`), {
+						method: 'PUT',
+						body: JSON.stringify($settings)
+					}).then((response) => {
+						if (response.ok)
+							addNotification(
+								options({
+									heading: 'Settings Sync',
+									description: 'Pushed local configuration to remote'
+								})
+							);
+					});
+				}}
+			>
+				Push Local Configuration
+			</button>
+			<SettingHint lineBreak>
+				Enable settings sync and overwrite any remote configuration with your local settings
+			</SettingHint>
+		{:else}
+			<button
+				on:click={() => {
+					$settings.settingsSync = false;
+
+					addNotification(
+						options({
+							heading: 'Settings sync disabled'
+						})
+					);
+				}}
+			>
+				Disable &amp; Keep Local Configuration
+			</button>
+		{/if}
+	</Category>
 	<Category title={$locale().settings.rssFeeds.title} id="feeds">
 		<button
 			on:click={() => {
-- 
cgit v1.2.3

