aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard/preview/LinkContentSection.tsx
diff options
context:
space:
mode:
authorEvan Simkowitz <esimkowitz@users.noreply.github.com>2025-12-14 16:39:25 -0800
committerGitHub <noreply@github.com>2025-12-15 00:39:25 +0000
commit7f4202afd73105b850498b55ad66922b3505f0e3 (patch)
treea45f9f1b2599f4c9925e36dc51563b06ba6854ac /apps/web/components/dashboard/preview/LinkContentSection.tsx
parent6db14ac492cd5d9e26d0d986513771f14faa7fd0 (diff)
downloadkarakeep-7f4202afd73105b850498b55ad66922b3505f0e3.tar.zst
feat: Add unified reader settings with local overrides (#2230)
* Add initial impl * fix some format inconsistencies, add indicator in user settings when local is out of sync * Fix sliders in user settings, unify constants and formatting * address CodeRabbit suggestions * add mobile implementation * address coderabbit nitpicks * fix responsiveness of the reader settings popover * Move more of the web UI strings to i18n * update translations for more coverage * remove duplicate logic/definitions * fix android font family * add shared reading setting hook between web and mobile * unify reader settings context for both web and mobile * remove unused export * address coderabbit suggestions * fix tests
Diffstat (limited to 'apps/web/components/dashboard/preview/LinkContentSection.tsx')
-rw-r--r--apps/web/components/dashboard/preview/LinkContentSection.tsx34
1 files changed, 23 insertions, 11 deletions
diff --git a/apps/web/components/dashboard/preview/LinkContentSection.tsx b/apps/web/components/dashboard/preview/LinkContentSection.tsx
index 64b62df6..75b6df14 100644
--- a/apps/web/components/dashboard/preview/LinkContentSection.tsx
+++ b/apps/web/components/dashboard/preview/LinkContentSection.tsx
@@ -17,6 +17,7 @@ import {
TooltipTrigger,
} from "@/components/ui/tooltip";
import { useTranslation } from "@/lib/i18n/client";
+import { useReaderSettings } from "@/lib/readerSettings";
import {
AlertTriangle,
Archive,
@@ -34,8 +35,10 @@ import {
ZBookmark,
ZBookmarkedLink,
} from "@karakeep/shared/types/bookmarks";
+import { READER_FONT_FAMILIES } from "@karakeep/shared/types/readers";
import { contentRendererRegistry } from "./content-renderers";
+import ReaderSettingsPopover from "./ReaderSettingsPopover";
import ReaderView from "./ReaderView";
function CustomRendererErrorFallback({ error }: { error: Error }) {
@@ -106,6 +109,7 @@ export default function LinkContentSection({
bookmark: ZBookmark;
}) {
const { t } = useTranslation();
+ const { settings } = useReaderSettings();
const availableRenderers = contentRendererRegistry.getRenderers(bookmark);
const defaultSection =
availableRenderers.length > 0 ? availableRenderers[0].id : "cached";
@@ -135,6 +139,11 @@ export default function LinkContentSection({
<ScrollArea className="h-full">
<ReaderView
className="prose mx-auto dark:prose-invert"
+ style={{
+ fontFamily: READER_FONT_FAMILIES[settings.fontFamily],
+ fontSize: `${settings.fontSize}px`,
+ lineHeight: settings.lineHeight,
+ }}
bookmarkId={bookmark.id}
readOnly={!isOwner}
/>
@@ -213,17 +222,20 @@ export default function LinkContentSection({
</SelectContent>
</Select>
{section === "cached" && (
- <Tooltip>
- <TooltipTrigger>
- <Link
- href={`/reader/${bookmark.id}`}
- className={buttonVariants({ variant: "outline" })}
- >
- <ExpandIcon className="h-4 w-4" />
- </Link>
- </TooltipTrigger>
- <TooltipContent side="bottom">FullScreen</TooltipContent>
- </Tooltip>
+ <>
+ <ReaderSettingsPopover />
+ <Tooltip>
+ <TooltipTrigger>
+ <Link
+ href={`/reader/${bookmark.id}`}
+ className={buttonVariants({ variant: "outline" })}
+ >
+ <ExpandIcon className="h-4 w-4" />
+ </Link>
+ </TooltipTrigger>
+ <TooltipContent side="bottom">FullScreen</TooltipContent>
+ </Tooltip>
+ </>
)}
</div>
{content}