From c4bf52dd97e6b674c4689de811686fb345df6832 Mon Sep 17 00:00:00 2001 From: Anas Rashid Date: Fri, 9 Oct 2026 15:23:06 +0200 Subject: [PATCH] =?UTF-8?q?Icons=20and=20colour=20roles:=20header=20icons?= =?UTF-8?q?=20with=20tooltips=20and=20a=20red=20log=20out;=20buttons=20col?= =?UTF-8?q?oured=20by=20what=20they=20do;=20=D9=85=D8=AD=D9=81=D9=88=D8=B8?= =?UTF-8?q?=20=D8=B4=D8=AF=DB=81=20and=20=D9=BE=D8=B3=D9=86=D8=AF=DB=8C?= =?UTF-8?q?=D8=AF=DB=81=20=D9=84=DA=A9=DA=BE=D8=A7=D8=B1=DB=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Icon component (Lucide shapes, ISC), currentColor, decorative (the control keeps its words in aria-label/title). - Colour roles: --action (primary, filled), --ok (approve, publish), --danger (log out, delete, reject); .btn variants and .icon-btn; light and dark. - Header: admin, moderation, saved, word book, account/sign in, font, theme as icons; log out in red. - Review: save/send filled, approve/publish green, return plain, reject red, with icons. Account: save, log out, password, delete. Reading pages: edit, history, arrange, tag. E-books: add, download, covers; the reader's controls as icons. - نشانات is now محفوظ شدہ; favourite writers have their own page, پسندیدہ لکھاری (/writers). Co-Authored-By: Claude Opus 5.5 --- web/src/components/Icon.astro | 35 +++++++++++++++++++++++++++ web/src/components/LibraryNav.astro | 7 +++--- web/src/components/Seg.astro | 2 +- web/src/layouts/Base.astro | 29 +++++++++++++--------- web/src/lib/pdfreader.ts | 2 +- web/src/pages/[...path].astro | 13 +++++----- web/src/pages/[poet]/ebooks.astro | 3 ++- web/src/pages/account.astro | 9 +++---- web/src/pages/ebook/[id].astro | 15 ++++++------ web/src/pages/library.astro | 29 ++++++++-------------- web/src/pages/mod/rev/[id].astro | 23 ++++++++++-------- web/src/pages/writers.astro | 22 +++++++++++++++++ web/src/styles/global.css | 37 +++++++++++++++++++++++------ 13 files changed, 156 insertions(+), 70 deletions(-) create mode 100644 web/src/components/Icon.astro create mode 100644 web/src/pages/writers.astro diff --git a/web/src/components/Icon.astro b/web/src/components/Icon.astro new file mode 100644 index 00000000..005afb5c --- /dev/null +++ b/web/src/components/Icon.astro @@ -0,0 +1,35 @@ +--- +// Icons (Lucide, ISC licence; https://lucide.dev): drawn with currentColor, so they take the colour of their button +// or link. Decorative: the button or link carries the words (aria-label/title, or its text). +const { name, size = 20 } = Astro.props as { name: keyof typeof PATHS; size?: number }; +const PATHS = { + admin: '', + edit: '', + bookmark: '', + words: '', + user: '', + login: '', + logout: '', + theme: '', + font: '', + tag: '', + arrange: '', + history: '', + upload: '', + download: '', + check: '', + close: '', + undo: '', + send: '', + save: '', + full: '', + next: '', // points left: forward in a right-to-left page + prev: '', + trash: '', + key: '', + image: '', + plus: '', + external: '', +}; +--- + diff --git a/web/src/components/LibraryNav.astro b/web/src/components/LibraryNav.astro index 9afb2990..47f30db2 100644 --- a/web/src/components/LibraryNav.astro +++ b/web/src/components/LibraryNav.astro @@ -1,9 +1,10 @@ --- -// tabs between the reader's bookmarks and their word book (kept separate) -const { current } = Astro.props as { current: 'bookmarks' | 'words' }; +// tabs of the reader's own space: saved texts, favourite writers, the word book (kept separate), profile +const { current } = Astro.props as { current: 'bookmarks' | 'writers' | 'words' }; --- diff --git a/web/src/components/Seg.astro b/web/src/components/Seg.astro index 95275948..4576db74 100644 --- a/web/src/components/Seg.astro +++ b/web/src/components/Seg.astro @@ -3,4 +3,4 @@ const { s } = Astro.props as { s: [string, string, string?][] }; --- {s.map(([t, k, d]) => (k === 'mark' ? {t} : k === 'pen' ? {t} - : k === 'bmk' ? {t} : t))} + : k === 'bmk' ? {t} : t))} diff --git a/web/src/layouts/Base.astro b/web/src/layouts/Base.astro index 5fb512d6..3aafe70d 100644 --- a/web/src/layouts/Base.astro +++ b/web/src/layouts/Base.astro @@ -8,6 +8,7 @@ import '../styles/global.css'; interface Props { title?: string; description?: string; q?: string } const { title, description = 'اردو کی کلاسیکی شاعری اور نثر', q = '' } = Astro.props; const fullTitle = title ? `${title} · دیوان` : 'دیوان · اردو کی کلاسیکی شاعری اور نثر'; +import Icon from '../components/Icon.astro'; --- @@ -43,17 +44,23 @@ const fullTitle = title ? `${title} · دیوان` : 'دیوان · اردو ک -
- {Astro.locals.user?.role === 'admin' && } - {['mod-l2', 'mod-l1', 'admin'].includes(Astro.locals.user?.role ?? '') && } - {Astro.locals.user && } - {Astro.locals.user && } +
+ ? + : } + + + {Astro.locals.user && ( +
+ + +
+ )} + @@ -88,7 +95,7 @@ const fullTitle = title ? `${title} · دیوان` : 'دیوان · اردو ک