From 67c15413619e48d71f94f0aba07cd08d00a83a1c Mon Sep 17 00:00:00 2001 From: 7eliassen Date: Wed, 23 Sep 2026 12:30:25 +0300 Subject: [PATCH 1/4] feat: add appearance and sidebar part in notes settings --- src/application/i18n/messages/en.json | 20 ++ .../noteSettings/NoteSidebarSetting.vue | 307 ++++++++++++++++++ src/presentation/pages/NoteSettings.vue | 7 + 3 files changed, 334 insertions(+) create mode 100644 src/presentation/components/noteSettings/NoteSidebarSetting.vue diff --git a/src/application/i18n/messages/en.json b/src/application/i18n/messages/en.json index 5c39816e..59bf3f69 100644 --- a/src/application/i18n/messages/en.json +++ b/src/application/i18n/messages/en.json @@ -49,6 +49,26 @@ "availabilityTitle": "Availability", "availabilityCaption": "Should the Note be available by its URL for people who knows it?", "availabilityRowTitle": "Note is published", + "appearance": "Appearance", + "sidebar": { + "title": "Sidebar", + "caption": "Choose how the sidebar is shown for this Note", + "hint": "Applies to this note for everyone who opens it, including readers of the published version.", + "options": { + "none": { + "title": "No sidebar", + "subtitle": "Content only, full window" + }, + "edge": { + "title": "Pinned to page edge", + "subtitle": "Sidebar sticks to the left of the window" + }, + "content": { + "title": "Pinned to content", + "subtitle": "Sidebar follows the centered column" + } + } + }, "inviteCollaboratorTitle": "Invite a collaborator", "inviteCollaboratorCaption": "Send this link to someone you want to add as an editor or reader.", "revokeHashButton": "Revoke", diff --git a/src/presentation/components/noteSettings/NoteSidebarSetting.vue b/src/presentation/components/noteSettings/NoteSidebarSetting.vue new file mode 100644 index 00000000..3a712460 --- /dev/null +++ b/src/presentation/components/noteSettings/NoteSidebarSetting.vue @@ -0,0 +1,307 @@ + + + + + diff --git a/src/presentation/pages/NoteSettings.vue b/src/presentation/pages/NoteSettings.vue index f2cbccc6..aa065838 100644 --- a/src/presentation/pages/NoteSettings.vue +++ b/src/presentation/pages/NoteSettings.vue @@ -63,6 +63,12 @@ +
+ +
+
@@ -110,6 +116,7 @@ import { Section, Row, Switch, Button, Heading, Fieldset, Input, Card, PageBlock import { getTitle } from '@/infrastructure/utils/note'; import { getTimeFromNow } from '@/infrastructure/utils/date'; import InviteLink from '@/presentation/components/noteSettings/InviteLink.vue'; +import NoteSidebarSetting from '@/presentation/components/noteSettings/NoteSidebarSetting.vue'; import useNavbar from '@/application/services/useNavbar'; import { useRoute } from 'vue-router'; import { TeamMember } from '@/domain/entities/Team'; From b43f7f58e8bb8bb8d29d6065c5154b04fb3ee1e2 Mon Sep 17 00:00:00 2001 From: 7eliassen Date: Wed, 23 Sep 2026 13:41:14 +0300 Subject: [PATCH 2/4] feat: get and set the sidebarPosition value from API --- src/application/services/useNoteSettings.ts | 20 ++++++++++++ src/domain/entities/NoteSettings.ts | 10 ++++++ .../noteSettings/NoteSidebarSetting.vue | 32 +++++++++++++++---- src/presentation/pages/NoteSettings.vue | 17 ++++++++-- 4 files changed, 70 insertions(+), 9 deletions(-) diff --git a/src/application/services/useNoteSettings.ts b/src/application/services/useNoteSettings.ts index bd488b3a..b2722ce4 100644 --- a/src/application/services/useNoteSettings.ts +++ b/src/application/services/useNoteSettings.ts @@ -1,5 +1,6 @@ import { ref, type Ref } from 'vue'; import type NoteSettings from '@/domain/entities/NoteSettings'; +import type { SidebarPosition } from '@/domain/entities/NoteSettings'; import type { Note, NoteId } from '@/domain/entities/Note'; import { noteSettingsService, noteService } from '@/domain'; import type { UserId } from '@/domain/entities/User'; @@ -33,6 +34,13 @@ interface UseNoteSettingsComposableState { */ updateIsPublic: (id: NoteId, newIsPublicValue: boolean) => Promise; + /** + * Update sidebar position in note settings + * @param id - note id + * @param sidebarPosition - new sidebar position + */ + updateSidebarPosition: (id: NoteId, sidebarPosition: SidebarPosition) => Promise; + /** * Revoke invitation hash * @param id - note id @@ -124,6 +132,17 @@ export default function (): UseNoteSettingsComposableState { } } + /** + * Update sidebar position in note settings + * @param id - Note id + * @param sidebarPosition - new sidebar position + */ + async function updateSidebarPosition(id: NoteId, sidebarPosition: SidebarPosition): Promise { + const response = await noteSettingsService.patchNoteSettingsByNoteId(id, { sidebarPosition }); + + noteSettings.value = response; + } + /** * Revoke invitation hash * @param id - Note id @@ -213,6 +232,7 @@ export default function (): UseNoteSettingsComposableState { noteSettings, load, updateIsPublic, + updateSidebarPosition, revokeHash, changeRole, deleteNoteById, diff --git a/src/domain/entities/NoteSettings.ts b/src/domain/entities/NoteSettings.ts index 93b1551b..d3fe570a 100644 --- a/src/domain/entities/NoteSettings.ts +++ b/src/domain/entities/NoteSettings.ts @@ -5,6 +5,11 @@ import type { Team } from './Team'; */ export type InvitationHash = string; +/** + * Position of the sidebar relative to the note content + */ +export type SidebarPosition = 'content' | 'edge' | 'none'; + /** * NoteSettings entity */ @@ -38,4 +43,9 @@ export default interface NoteSettings { * Note cover image id */ cover: string; + + /** + * Position of the sidebar, 'content' by default + */ + sidebarPosition: SidebarPosition; } diff --git a/src/presentation/components/noteSettings/NoteSidebarSetting.vue b/src/presentation/components/noteSettings/NoteSidebarSetting.vue index 3a712460..0ffc2668 100644 --- a/src/presentation/components/noteSettings/NoteSidebarSetting.vue +++ b/src/presentation/components/noteSettings/NoteSidebarSetting.vue @@ -8,8 +8,8 @@
-
+