Skip to content

Commit 37adf2c

Browse files
committed
up style of imgViewer modal and description
1 parent 9ebde43 commit 37adf2c

34 files changed

+438
-79
lines changed

src/renderer/assets/styles/components/modals.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
box-sizing: border-box;
4545
border: 1px solid var(--color-gray-250);
4646

47+
@include mx.scrollbar_styling;
48+
4749
&.modal_dialog_full {
4850
position: relative;
4951
box-sizing: border-box;
@@ -53,7 +55,6 @@
5355
height: calc(100vh - 100px);
5456
}
5557
}
56-
5758
background-color: var(--color-neutral-base);
5859
color: var(--color-text-primary);
5960

@@ -260,6 +261,19 @@
260261
}
261262
}
262263

264+
.imageViewerContent {
265+
position: relative;
266+
display: flex;
267+
gap: 10;
268+
width: 100%;
269+
height: 100%;
270+
padding-left: 5;
271+
flex: 1;
272+
flex-direction: column;
273+
274+
@include mx.scrollbar_styling
275+
}
276+
263277
.CSS_END_components_modals {
264278
display: none;
265279
}

src/renderer/assets/styles/components/modals.scss.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export declare const field: string;
99
export declare const guidedTour_buttons: string;
1010
export declare const guidedTour_content: string;
1111
export declare const guidedTour_tab: string;
12+
export declare const imageViewerContent: string;
1213
export declare const lcp_hint: string;
1314
export declare const modal_dialog: string;
1415
export declare const modal_dialog_body: string;

src/renderer/reader/components/ImageClickManagerViewerOnly.tsx

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const Controls = () => {
4646
// opacity: 0;
4747
transition: 200ms;
4848
gap: 10px;
49+
margin-top: 10px;
4950
}
5051
5152
.imgViewerControls button {
@@ -91,7 +92,38 @@ export const ImageClickManagerImgViewerOnly: React.FC = () => {
9192
let scale = Math.min(scaleX, scaleY);
9293
if (scale > 1) scale = 1;
9394

94-
const imageDescription = dom_detailsText || dom_figcaptionText || dom_describedbyText || dom_labelledByText || altAttributeOf_HTMLImg_SVGImage_SVGFragment || "";
95+
const descriptions = [
96+
{ label: __("reader.imgViewer.description.details"), value: dom_detailsText },
97+
{ label: __("reader.imgViewer.description.figcaption"), value: dom_figcaptionText },
98+
{ label: __("reader.imgViewer.description.describedby"), value: dom_describedbyText },
99+
{ label: __("reader.imgViewer.description.labelledby"), value: dom_labelledByText },
100+
];
101+
102+
const hasAlt = !!altAttributeOf_HTMLImg_SVGImage_SVGFragment;
103+
const activeDescriptions = descriptions.filter(d => !!d.value);
104+
const hasOtherDescriptions = activeDescriptions.length > 0;
105+
106+
const imageHasDescription = hasAlt || hasOtherDescriptions;
107+
const imageHasOnlyAltDescription = hasAlt && !hasOtherDescriptions;
108+
109+
const DescriptionList = (
110+
<details style={{ fontSize: "14px", cursor: "pointer" }}>
111+
<summary>
112+
{altAttributeOf_HTMLImg_SVGImage_SVGFragment || __("reader.imgViewer.description.about")}
113+
</summary>
114+
<ul style={{ marginTop: "10px", listStyleType: "none", paddingLeft: 0 }}>
115+
{activeDescriptions.map(({ label, value }) => (
116+
<li key={label} style={{ marginBottom: "10px" }}>
117+
<strong>{label}: </strong> {value}
118+
</li>
119+
))}
120+
</ul>
121+
</details>
122+
);
123+
124+
const imageDescription = imageHasOnlyAltDescription
125+
? altAttributeOf_HTMLImg_SVGImage_SVGFragment
126+
: DescriptionList;
95127

96128
return (<>
97129

@@ -115,9 +147,10 @@ export const ImageClickManagerImgViewerOnly: React.FC = () => {
115147
</Dialog.Close>
116148
</div>
117149
<div style={{ display: "flex", flexDirection: "column", padding: "5px 10px", alignItems: "center", flex: 1 }}>
118-
<div style={{ position: "relative", display: "flex", gap: 10, width: "100%", height: "100%", paddingLeft: 5, flex: 1, flexDirection: "column" }}>
150+
<div className={stylesModals.imageViewerContent}>
151+
<div style={{transition: "600ms ease-in-out"}}>
119152
<TransformWrapper initialScale={scale} minScale={scale / 2} maxScale={4 * scale}>
120-
<TransformComponent wrapperStyle={{ display: "flex", width: "100%", height: "100%", minHeight: "350px", flex: "1", position: "relative" }} >
153+
<TransformComponent wrapperStyle={{ display: "flex", margin: "auto", width: "90%", height: "90%", minHeight: "350px", flex: "1", position: "relative", transition: "600ms ease-in-out" }} >
121154
<img
122155
style={{ height: "100%", width: "100%", maxHeight: "calc(100vh - 250px)", backgroundColor: "white", color: "black", fill: "currentcolor", stroke: "currentcolor" }}
123156
src={isSVGFragment ? ("data:image/svg+xml;base64," + Buffer.from(HTMLImgSrc_SVGImageHref_SVGFragmentMarkup).toString("base64")) : HTMLImgSrc_SVGImageHref_SVGFragmentMarkup}
@@ -129,12 +162,12 @@ export const ImageClickManagerImgViewerOnly: React.FC = () => {
129162
</TransformComponent>
130163
<Controls />
131164
</TransformWrapper>
132-
{imageDescription ?
133-
<p style={{ maxWidth: "unset", fontStyle: "italic"}}>
165+
</div>
166+
{imageHasDescription && (
167+
<div style={{ width: "100%", marginTop: "10px" }}>
134168
{imageDescription}
135-
</p>
136-
: <></>
137-
}
169+
</div>
170+
)}
138171
</div>
139172
</div>
140173
</Dialog.Content>

src/resources/locales/ar.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@
227227
"urlHint": "هل نسيت عبارة مرورك؟ اضغط هنا للحصول على الدعم.",
228228
"whatIsLcp?": "ما هي LCP؟",
229229
"whatIsLcpInfoDetails": "ترمز LCP إلى 'حماية المحتوى المرخَّص'.",
230-
"whatIsLcpInfoDetailsLink": "لمعرفة المزيد، اضغط على هذا الرابط لزيارة موقع EDRLab."
230+
"whatIsLcpInfoDetailsLink": "لمعرفة المزيد، اضغط على هذا الرابط لزيارة موقع EDRLab.",
231+
"showPassphrase": "",
232+
"hidePassphrase": ""
231233
}
232234
},
233235
"message": {
@@ -722,7 +724,15 @@
722724
"title": "عارض الصور (تكبير)",
723725
"zoomIn": "تكبير",
724726
"zoomOut": "تصغير",
725-
"zoomReset": "إعادة ضبط التكبير"
727+
"zoomReset": "إعادة ضبط التكبير",
728+
"description": {
729+
"altText": "",
730+
"details": "",
731+
"figcaption": "",
732+
"describedby": "",
733+
"labelledby": "",
734+
"about": ""
735+
}
726736
},
727737
"marks": {
728738
"annotations": "التعليقات",

src/resources/locales/bg.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@
207207
"urlHint": "Забравили сте паролата си? Намерете помощ тук.",
208208
"whatIsLcp?": "",
209209
"whatIsLcpInfoDetails": "",
210-
"whatIsLcpInfoDetailsLink": ""
210+
"whatIsLcpInfoDetailsLink": "",
211+
"showPassphrase": "",
212+
"hidePassphrase": ""
211213
}
212214
},
213215
"message": {
@@ -702,7 +704,15 @@
702704
"title": "",
703705
"zoomIn": "",
704706
"zoomOut": "",
705-
"zoomReset": ""
707+
"zoomReset": "",
708+
"description": {
709+
"altText": "",
710+
"details": "",
711+
"figcaption": "",
712+
"describedby": "",
713+
"labelledby": "",
714+
"about": ""
715+
}
706716
},
707717
"marks": {
708718
"annotations": "Анотации",

src/resources/locales/ca.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@
212212
"urlHint": "Has olvidat la contrassenya? Clica si necessites ajuda",
213213
"whatIsLcp?": "Què és LCP?",
214214
"whatIsLcpInfoDetails": "LCP significa 'Protecció del contingut llicenciat'.",
215-
"whatIsLcpInfoDetailsLink": "Per saber-ne més, feu clic en aquest enllaç a la pàgina web de l'EDRLab."
215+
"whatIsLcpInfoDetailsLink": "Per saber-ne més, feu clic en aquest enllaç a la pàgina web de l'EDRLab.",
216+
"showPassphrase": "",
217+
"hidePassphrase": ""
216218
}
217219
},
218220
"message": {
@@ -707,7 +709,15 @@
707709
"title": "",
708710
"zoomIn": "",
709711
"zoomOut": "",
710-
"zoomReset": ""
712+
"zoomReset": "",
713+
"description": {
714+
"altText": "",
715+
"details": "",
716+
"figcaption": "",
717+
"describedby": "",
718+
"labelledby": "",
719+
"about": ""
720+
}
711721
},
712722
"marks": {
713723
"annotations": "Anotacions",

src/resources/locales/cs.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@
217217
"urlHint": "Zapomněli jste svou heslovou frázi? Po získání podpory klikněte zde.",
218218
"whatIsLcp?": "Co je LCP?",
219219
"whatIsLcpInfoDetails": "LCP znamená „Licensed Content Protection“.",
220-
"whatIsLcpInfoDetailsLink": "Pro více informací klikněte na tento odkaz na webovou stránku EDRLabu."
220+
"whatIsLcpInfoDetailsLink": "Pro více informací klikněte na tento odkaz na webovou stránku EDRLabu.",
221+
"showPassphrase": "",
222+
"hidePassphrase": ""
221223
}
222224
},
223225
"message": {
@@ -712,7 +714,15 @@
712714
"title": "",
713715
"zoomIn": "",
714716
"zoomOut": "",
715-
"zoomReset": ""
717+
"zoomReset": "",
718+
"description": {
719+
"altText": "",
720+
"details": "",
721+
"figcaption": "",
722+
"describedby": "",
723+
"labelledby": "",
724+
"about": ""
725+
}
716726
},
717727
"marks": {
718728
"annotations": "Anotace",

src/resources/locales/da.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@
207207
"urlHint": "Har du glemt dit nøgleord? Få hjælp her.",
208208
"whatIsLcp?": "Hvad er LCP?",
209209
"whatIsLcpInfoDetails": "LCP står for 'Licensed Content Protection'.",
210-
"whatIsLcpInfoDetailsLink": "For at læse mere, følg dette link til EDRLab websitet."
210+
"whatIsLcpInfoDetailsLink": "For at læse mere, følg dette link til EDRLab websitet.",
211+
"showPassphrase": "",
212+
"hidePassphrase": ""
211213
}
212214
},
213215
"message": {
@@ -702,7 +704,15 @@
702704
"title": "Billedfremviser",
703705
"zoomIn": "Zoom ind",
704706
"zoomOut": "Zoom ud",
705-
"zoomReset": "Nulstil Zoom"
707+
"zoomReset": "Nulstil Zoom",
708+
"description": {
709+
"altText": "",
710+
"details": "",
711+
"figcaption": "",
712+
"describedby": "",
713+
"labelledby": "",
714+
"about": ""
715+
}
706716
},
707717
"marks": {
708718
"annotations": "Noter",

src/resources/locales/de.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@
207207
"urlHint": "Passwort vergessen? Klicke hier für Support.",
208208
"whatIsLcp?": "Was ist LCP?",
209209
"whatIsLcpInfoDetails": "LCP steht für „Licensed Content Protection“.",
210-
"whatIsLcpInfoDetailsLink": "Um mehr zu erfahren, klicken Sie auf diesen Link zur EDRLab-Website."
210+
"whatIsLcpInfoDetailsLink": "Um mehr zu erfahren, klicken Sie auf diesen Link zur EDRLab-Website.",
211+
"showPassphrase": "",
212+
"hidePassphrase": ""
211213
}
212214
},
213215
"message": {
@@ -702,7 +704,15 @@
702704
"title": "",
703705
"zoomIn": "",
704706
"zoomOut": "",
705-
"zoomReset": ""
707+
"zoomReset": "",
708+
"description": {
709+
"altText": "",
710+
"details": "",
711+
"figcaption": "",
712+
"describedby": "",
713+
"labelledby": "",
714+
"about": ""
715+
}
706716
},
707717
"marks": {
708718
"annotations": "Meine Anmerkungen",

src/resources/locales/el.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@
207207
"urlHint": "Ξέχασες τα αναγνωριστικά σου; Κλίκαρε εδώ για βοήθεια.",
208208
"whatIsLcp?": "Τι είναι η προστασία LCP;",
209209
"whatIsLcpInfoDetails": "Το LCP σημαίνει 'Προστασία αδειοδοτημένου περιεχομένου'.",
210-
"whatIsLcpInfoDetailsLink": "Για περισσότερα, κάντε κλικ σε αυτόν τον σύνδεσμο προς τον ιστότοπο του EDRLab."
210+
"whatIsLcpInfoDetailsLink": "Για περισσότερα, κάντε κλικ σε αυτόν τον σύνδεσμο προς τον ιστότοπο του EDRLab.",
211+
"showPassphrase": "",
212+
"hidePassphrase": ""
211213
}
212214
},
213215
"message": {
@@ -702,7 +704,15 @@
702704
"title": "Προβολή εικόνων (zoom)",
703705
"zoomIn": "Μεγέθυνση",
704706
"zoomOut": "Σμίκρυνση",
705-
"zoomReset": "Επαναφορά Zoom"
707+
"zoomReset": "Επαναφορά Zoom",
708+
"description": {
709+
"altText": "",
710+
"details": "",
711+
"figcaption": "",
712+
"describedby": "",
713+
"labelledby": "",
714+
"about": ""
715+
}
706716
},
707717
"marks": {
708718
"annotations": "Σχόλια",

0 commit comments

Comments
 (0)