+ Wellness Settings
+
+
+ Wellness settings are designed to reduce the addictive or anxiety-inducing aspects of social media.
+ Choose any options that work well for you.
+
+
+
+
+ Metrics
+
+
+
+ Notifications
+
+
+
+
+
+ UI
+
+
+
+ These settings are partly based on guidelines from the
+ Center for Humane Technology.
+
+
+
+
diff --git a/src/routes/_static/themes.js b/src/routes/_static/themes.js
index f52dd9cc..7f0b5754 100644
--- a/src/routes/_static/themes.js
+++ b/src/routes/_static/themes.js
@@ -41,6 +41,12 @@ const themes = [
dark: false,
color: '#4ab92f'
},
+ {
+ name: 'grayscale',
+ label: 'Grayscale',
+ dark: false,
+ color: '#999999'
+ },
{
name: 'ozark',
label: 'Ozark',
@@ -88,6 +94,12 @@ const themes = [
label: 'Pitch Black',
dark: true,
color: '#000'
+ },
+ {
+ name: 'dark-grayscale',
+ label: 'Dark Grayscale',
+ dark: true,
+ color: '#666'
}
]
diff --git a/src/routes/_store/LocalStorageStore.js b/src/routes/_store/LocalStorageStore.js
index 4c1bb8db..edfa019c 100644
--- a/src/routes/_store/LocalStorageStore.js
+++ b/src/routes/_store/LocalStorageStore.js
@@ -1,10 +1,7 @@
import { Store } from 'svelte/store'
import { safeLocalStorage as LS } from '../_utils/safeLocalStorage'
import lifecycle from 'page-lifecycle/dist/lifecycle.mjs'
-
-function safeParse (str) {
- return !str ? undefined : (str === 'undefined' ? undefined : JSON.parse(str))
-}
+import { safeParse } from './safeParse'
export class LocalStorageStore extends Store {
constructor (state, keysToWatch) {
diff --git a/src/routes/_store/computations/timelineComputations.js b/src/routes/_store/computations/timelineComputations.js
index 5280151d..5716929d 100644
--- a/src/routes/_store/computations/timelineComputations.js
+++ b/src/routes/_store/computations/timelineComputations.js
@@ -174,7 +174,9 @@ export function timelineComputations (store) {
)
store.compute('hasNotifications',
- ['numberOfNotifications', 'currentPage'],
- (numberOfNotifications, currentPage) => currentPage !== 'notifications' && !!numberOfNotifications
+ ['numberOfNotifications', 'currentPage', 'disableNotificationBadge'],
+ (numberOfNotifications, currentPage, $disableNotificationBadge) => (
+ !$disableNotificationBadge && currentPage !== 'notifications' && !!numberOfNotifications
+ )
)
}
diff --git a/src/routes/_store/observers/grayscaleObservers.js b/src/routes/_store/observers/grayscaleObservers.js
new file mode 100644
index 00000000..04d19772
--- /dev/null
+++ b/src/routes/_store/observers/grayscaleObservers.js
@@ -0,0 +1,14 @@
+import { switchToTheme } from '../../_utils/themeEngine'
+
+export function grayscaleObservers (store) {
+ if (!process.browser) {
+ return
+ }
+
+ store.observe('enableGrayscale', enableGrayscale => {
+ const { instanceThemes, currentInstance } = store.get()
+ const theme = instanceThemes && instanceThemes[currentInstance]
+ document.body.classList.toggle('grayscale', enableGrayscale)
+ switchToTheme(theme, enableGrayscale)
+ })
+}
diff --git a/src/routes/_store/observers/observers.js b/src/routes/_store/observers/observers.js
index ff8f6b1f..527f6441 100644
--- a/src/routes/_store/observers/observers.js
+++ b/src/routes/_store/observers/observers.js
@@ -6,6 +6,7 @@ import { resizeObservers } from './resizeObservers'
import { setupLoggedInObservers } from './setupLoggedInObservers'
import { logOutObservers } from './logOutObservers'
import { touchObservers } from './touchObservers'
+import { grayscaleObservers } from './grayscaleObservers'
export function observers (store) {
onlineObservers(store)
@@ -15,5 +16,6 @@ export function observers (store) {
resizeObservers(store)
touchObservers(store)
logOutObservers(store)
+ grayscaleObservers(store)
setupLoggedInObservers(store)
}
diff --git a/src/routes/_store/observers/onlineObservers.js b/src/routes/_store/observers/onlineObservers.js
index ebe9a156..a0c73087 100644
--- a/src/routes/_store/observers/onlineObservers.js
+++ b/src/routes/_store/observers/onlineObservers.js
@@ -6,8 +6,6 @@ const NOTIFY_OFFLINE_LIMIT = 1
let notifyCount = 0
-let offlineStyle = process.browser && document.getElementById('theOfflineStyle')
-
// debounce to avoid notifying for a short connection issue
const notifyOffline = debounce(() => {
if (process.browser && !navigator.onLine && ++notifyCount <= NOTIFY_OFFLINE_LIMIT) {
@@ -19,20 +17,9 @@ export function onlineObservers (store) {
if (!process.browser) {
return
}
- let meta = document.getElementById('theThemeColor')
- let oldTheme = meta.content
store.observe('online', online => {
- // "only x" ensures the