diff --git a/PinkSea.AtProto.Shared/Lexicons/AtProto/PutRecordResponse.cs b/PinkSea.AtProto.Shared/Lexicons/AtProto/PutRecordResponse.cs index 95ab228..4fdfce2 100644 --- a/PinkSea.AtProto.Shared/Lexicons/AtProto/PutRecordResponse.cs +++ b/PinkSea.AtProto.Shared/Lexicons/AtProto/PutRecordResponse.cs @@ -24,11 +24,11 @@ public class PutRecordResponse /// The commit of the record. /// [JsonPropertyName("commit")] - public required Commit Commit { get; set; } + public Commit? Commit { get; set; } /// /// The validation result of the record. /// [JsonPropertyName("validationStatus")] - public required string ValidationStatus { get; set; } + public string? ValidationStatus { get; set; } } \ No newline at end of file diff --git a/PinkSea.Frontend/src/api/atproto/lexicons.ts b/PinkSea.Frontend/src/api/atproto/lexicons.ts index c164727..59a7cd1 100644 --- a/PinkSea.Frontend/src/api/atproto/lexicons.ts +++ b/PinkSea.Frontend/src/api/atproto/lexicons.ts @@ -58,6 +58,16 @@ declare module '@atcute/client/lexicons' { } } + // eslint-disable-next-line @typescript-eslint/no-namespace + namespace ComShinolabsPinkseaPutPreference { + interface Input { + key: string + value: string + } + interface Output { + } + } + // eslint-disable-next-line @typescript-eslint/no-namespace namespace ComShinolabsPinkseaDeleteOekaki { interface Input { @@ -132,6 +142,16 @@ declare module '@atcute/client/lexicons' { } } + // eslint-disable-next-line @typescript-eslint/no-namespace + namespace ComShinolabsPinkseaGetPreferences { + interface Output { + preferences: { + key: string, + value: string + }[] + } + } + // eslint-disable-next-line @typescript-eslint/no-namespace namespace ComShinolabsPinkseaGetSearchResults { interface Params { @@ -188,6 +208,10 @@ declare module '@atcute/client/lexicons' { 'com.shinolabs.pinksea.getSearchResults': { params: ComShinolabsPinkseaGetSearchResults.Params, output: ComShinolabsPinkseaGetSearchResults.Output + }, + 'com.shinolabs.pinksea.getPreferences': { + params: EmptyParams, + output: ComShinolabsPinkseaGetPreferences.Output } } @@ -215,6 +239,10 @@ declare module '@atcute/client/lexicons' { 'com.shinolabs.pinksea.beginLoginFlow': { input: ComShinolabsPinkseaBeginLoginFlow.Input, output: ComShinolabsPinkseaBeginLoginFlow.Output + }, + 'com.shinolabs.pinksea.putPreference': { + input: ComShinolabsPinkseaPutPreference.Input, + output: ComShinolabsPinkseaPutPreference.Output } } } diff --git a/PinkSea.Frontend/src/api/tegaki/tegaki.js b/PinkSea.Frontend/src/api/tegaki/tegaki.js index a4be0c7..980065f 100644 --- a/PinkSea.Frontend/src/api/tegaki/tegaki.js +++ b/PinkSea.Frontend/src/api/tegaki/tegaki.js @@ -2,6 +2,7 @@ import i18n from '@/intl/i18n.ts' import { usePersistedStore } from '@/state/store.ts'; +import { usePdsPreferencesStore } from '@/state/preferences.ts' function TegakiStrings() { let currentLanguage = usePersistedStore().lang @@ -2847,6 +2848,8 @@ export var Tegaki = { } } + self.initTheme(); + self.visible = true; }, @@ -2886,6 +2889,14 @@ export var Tegaki = { self.toolColor = $T.RgbToHex(...r.toolColor); }, + initTheme: function() { + console.log("initTheme") + const store = usePdsPreferencesStore() + console.log(store.editorDarkMode) + const theme = store.editorDarkMode === true ? 'dark' : 'light'; + this.setTheme(theme) + }, + initToolsFromReplay: function() { var self, r, name, tool, rTool, prop, props; @@ -3493,7 +3504,7 @@ export var Tegaki = { }, //Toggles light/dark mode and changes icon of toggle button - onThemeToggle: function() { + onThemeToggle: async function() { const toggleButton = document.getElementById('tegaki-theme-toggle'); @@ -3512,6 +3523,9 @@ export var Tegaki = { htmlElement.dataset.theme = 'light'; } + const store = usePdsPreferencesStore() + await store.set('editorDarkMode', isLightMode) + }, setTheme: function(theme) { diff --git a/PinkSea.Frontend/src/components/TimeLineOekakiCard.vue b/PinkSea.Frontend/src/components/TimeLineOekakiCard.vue index da7cba9..ea2d433 100644 --- a/PinkSea.Frontend/src/components/TimeLineOekakiCard.vue +++ b/PinkSea.Frontend/src/components/TimeLineOekakiCard.vue @@ -2,12 +2,12 @@ import { computed } from 'vue' import type { Oekaki } from '@/models/oekaki' import { useRouter } from 'vue-router' -import { usePersistedStore } from '@/state/store' import { buildOekakiUrlFromOekakiObject } from '@/api/atproto/helpers' import OekakiMetaContainer from './oekaki/OekakiMetaContainer.vue' +import { usePdsPreferencesStore } from '@/state/preferences' const router = useRouter(); -const persistedStore = usePersistedStore(); +const preferencesStore = usePdsPreferencesStore() const props = defineProps<{ oekaki: Oekaki @@ -30,10 +30,10 @@ const openInNewTab = () => {