Skip to content

Commit 128b5a9

Browse files
committed
feat: added feature and setting for whether to show the current comic's tagline as its tooltip
Closes #47
1 parent 014b68a commit 128b5a9

5 files changed

Lines changed: 30 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Add guest comic/non-canon pills to `ComicList`
1313
- Add Storybook link to README
1414
- Added list of comics an item is featured in. Closes [#19](https://github.com/Questionable-Content-Extensions/client/issues/19)
15+
- Added feature and setting for whether to show the current comic's tagline as its tooltip. Closes [#47](https://github.com/Questionable-Content-Extensions/client/issues/47)
1516

1617
### Changed 🔧
1718

src/components/Comic/Comic.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ function Comic({
144144
initialComicSrc={initialComicSrc}
145145
initialComic={initialComic}
146146
imageReady={imageReady}
147+
tagline={
148+
settings?.showTaglineAsTooltip && comicData?.hasData
149+
? comicData.tagline
150+
: null
151+
}
147152
/>
148153
</a>
149154
<FullPageLoader

src/components/Comic/ComicImage/ComicImage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ export default function ComicImage({
1212
imageData,
1313
initialComicSrc,
1414
initialComic,
15-
1615
imageReady,
16+
tagline,
1717
}: {
1818
imageData: { comicNo: number | null; imageType: ImageType | null }
1919
initialComicSrc: string
2020
initialComic: number
2121
imageReady: () => void
22+
tagline: string | null
2223
}) {
2324
const [comicSrc, setComicSrc] = useState(initialComicSrc)
2425
const [previousImageData, setPreviousImageData] = useState(imageData)
@@ -111,6 +112,7 @@ export default function ComicImage({
111112
className="qc-ext qc-ext-comic"
112113
src={comicSrc}
113114
alt={`Comic #${previousImageData.comicNo || initialComic}`}
115+
title={tagline ?? undefined}
114116
/>
115117
)
116118
}

src/components/SettingsDialog/SettingsPanel/SettingsPanel.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ export default function SettingsPanel({
7575
'information over the top-right corner of the comic strip.'
7676
}
7777
/>
78+
<ToggleSetting
79+
settings={settings}
80+
setting="showTaglineAsTooltip"
81+
updateSettings={updateSettings}
82+
label="Show tagline as comic tooltip"
83+
description={
84+
'When this setting is enabled and the currently shown comic strip has a tagline, its tagline will ' +
85+
"become the comic strip's tooltip."
86+
}
87+
/>
7888
<ToggleSetting
7989
settings={settings}
8090
setting="useCorrectTimeFormat"

src/settings.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export interface SettingValues {
3535

3636
subDivideGotoComics: boolean
3737

38+
showTaglineAsTooltip: boolean
39+
3840
/**
3941
* The last version seen by the change log dialog.
4042
* Used to know when we need to urge users to open it
@@ -88,9 +90,6 @@ export class Settings {
8890
scrollToTop: true,
8991

9092
showAllMembers: false,
91-
showCast: true,
92-
showStorylines: true,
93-
showLocations: true,
9493
useColors: true,
9594

9695
skipNonCanon: false,
@@ -100,13 +99,21 @@ export class Settings {
10099
editModeToken: '',
101100

102101
showIndicatorRibbon: true,
103-
showSmallRibbonByDefault: false,
104102
useCorrectTimeFormat: true,
105103
comicLoadingIndicatorDelay: 2000,
106104

107105
subDivideGotoComics: true,
108106

107+
showTaglineAsTooltip: true,
108+
109109
version: null,
110+
111+
// DEPRECATED:
112+
113+
showCast: true,
114+
showStorylines: true,
115+
showLocations: true,
116+
showSmallRibbonByDefault: false,
110117
}
111118

112119
values: SettingValues

0 commit comments

Comments
 (0)