Skip to content

Commit a884578

Browse files
authored
Merge pull request #579 from Alt-Org/juhaj77/enhancement/475-issue-updated-update-gallery-page
Juhaj77/enhancement/475 issue updated update gallery page
2 parents 28c29c8 + 0bd782e commit a884578

File tree

19 files changed

+386
-174
lines changed

19 files changed

+386
-174
lines changed

frontend-next-migration/src/app/[lng]/(helper)/picture-galleries/layout.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { LayoutWithSidebars } from '@/preparedPages/Layouts';
44
import { GalleryNavMenuAsDropdown } from '@/features/NavigateGalleries';
55
import useSizes from '@/shared/lib/hooks/useSizes';
66
import { useClientTranslation } from '@/shared/i18n';
7+
import { PageTitle } from '@/shared/ui/PageTitle';
78
import { cls } from '@/preparedPages/PictureGalleryPages';
89

910
export default function PictureGalleryLayout({ children }: { children: ReactNode }) {
@@ -14,13 +15,25 @@ export default function PictureGalleryLayout({ children }: { children: ReactNode
1415
return (
1516
<LayoutWithSidebars
1617
leftTopSidebar={{
17-
component: <GalleryNavMenuAsDropdown openByDefault={true} />,
18+
component: (
19+
<GalleryNavMenuAsDropdown
20+
className={cls.LeftSidebar}
21+
openByDefault={true}
22+
/>
23+
),
1824
hideOnMobile: true,
1925
}}
2026
>
21-
<h1 className={cls.Title}>{t('picture-galleries')}</h1>
22-
<p className={cls.InfoText}>{t('info-text')}</p>
23-
{isTouchDevice ? <GalleryNavMenuAsDropdown openByDefault={false} /> : null}
27+
{isTouchDevice && (
28+
<>
29+
<PageTitle
30+
titleText={t('picture-galleries-title')}
31+
alternate={true}
32+
searchVisible={false}
33+
/>
34+
<GalleryNavMenuAsDropdown openByDefault={false} />
35+
</>
36+
)}
2437
{children}
2538
</LayoutWithSidebars>
2639
);

frontend-next-migration/src/entities/Gallery/api/filterAndTransformImages.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ export const filterAndTransformImages = (
2020
version: string,
2121
): PhotoVersion[] => {
2222
try {
23-
let images: PhotoVersion[] = [];
24-
25-
if (version === 'full') {
26-
images = photoObjects.map((po) => ({
27-
id: po.versions.full.id,
28-
image: po.versions.full.image,
29-
width: po.versions.full.width,
30-
height: po.versions.full.height,
31-
altText: po.versions.full.altText,
32-
}));
23+
// Only allow the two supported versions
24+
if (version !== 'full' && version !== 'preview') {
25+
return [];
3326
}
3427

35-
if (version === 'preview') {
36-
images = photoObjects.map((po) => ({
37-
id: po.versions.preview.id,
38-
image: po.versions.preview.image,
39-
width: po.versions.preview.width,
40-
height: po.versions.preview.height,
41-
altText: po.versions.preview.altText,
42-
}));
43-
}
28+
// Filter out entries with missing versions or missing selected version
29+
const valid = photoObjects.filter((po) => {
30+
const v = po.versions;
31+
return !!(v && v[version]);
32+
});
33+
34+
const images: PhotoVersion[] = valid.map((po) => {
35+
const v = po.versions![version]!; // safe due to filtering above
36+
return {
37+
id: v.id,
38+
image: v.image,
39+
width: v.width,
40+
height: v.height,
41+
altText: v.altText || '',
42+
};
43+
});
4444

4545
return images;
4646
} catch (error) {

frontend-next-migration/src/entities/Gallery/model/mockImages.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ export const generateMockImages = (
9494
id: `${baseImage.id}-${i + 1}`,
9595
versions: {
9696
preview: {
97-
...baseImage.versions.preview,
98-
id: `${baseImage.versions.preview.id}-${i + 1}`,
97+
...baseImage.versions!.preview,
98+
id: `${baseImage.versions!.preview.id}-${i + 1}`,
9999
},
100100
full: {
101-
...baseImage.versions.full,
102-
id: `${baseImage.versions.full.id}-${i + 1}`,
101+
...baseImage.versions!.full,
102+
id: `${baseImage.versions!.full.id}-${i + 1}`,
103103
},
104104
},
105105
};

frontend-next-migration/src/entities/Gallery/types/gallery.d.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ export interface PhotoVersion {
4343
}
4444

4545
export interface PhotoObject {
46-
id: string;
47-
category: Category;
48-
versions: {
46+
title?: string;
47+
description?: string;
48+
supDescription?: string;
49+
frames?: string[][];
50+
id?: string;
51+
category?: Category;
52+
versions?: {
4953
preview: PhotoVersion;
5054
full: PhotoVersion;
5155
};

frontend-next-migration/src/features/NavigateGalleries/ui/GalleryNavMenuAsDropdown.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ import { useClientTranslation } from '@/shared/i18n';
1717

1818
interface GalleryNavMenuProps {
1919
openByDefault?: boolean;
20+
className?: string;
2021
}
2122

2223
const GalleryNavMenuAsDropdown = (props: GalleryNavMenuProps) => {
23-
const { openByDefault = false } = props;
24+
const { openByDefault = false, className } = props;
2425
const { isMobileSize, isTabletSize } = useSizes();
2526
const isTouchDevice = isMobileSize || isTabletSize;
2627
const params = useParams();
@@ -100,7 +101,7 @@ const GalleryNavMenuAsDropdown = (props: GalleryNavMenuProps) => {
100101
};
101102

102103
return (
103-
<div>
104+
<div className={className}>
104105
<nav style={isTouchDevice ? { display: 'contents' } : { display: 'none' }}>
105106
<NavMenuWithDropdowns {...navMenuWithDropdownsMobileProps} />
106107
</nav>

frontend-next-migration/src/preparedPages/DefenseGalleryPages/ui/DefenseGalleryPage.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343
margin-top: 1em;
4444
margin-bottom: 1em;
4545
font: var(--font-dm-m);
46+
@media (max-width: breakpoint(md)) {
47+
width: 100% !important;
48+
margin-inline: 0;
49+
}
4650
}
4751
.Container {
4852
margin-right: 3em;

frontend-next-migration/src/preparedPages/PictureGalleryPages/ui/PictureGalleryPage.module.scss

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,19 @@
44
flex-direction: column;
55
min-height: 100vh;
66
padding-bottom: 20px;
7+
// background-color: rgba(109, 39, 39, 0.322);
78

8-
//@media (max-width: breakpoint(xl)) {
9+
//@media (max-width: 1200px) {
910
// margin-top: 50px;
1011
//}
1112

1213
}
13-
14+
.LeftSidebar{
15+
margin-top: 6rem;
16+
}
17+
.Maincontainer{
18+
background-color: white !important;
19+
}
1420

1521
.Container{
1622
flex-grow: 1;
@@ -24,7 +30,6 @@
2430
width: 85%;
2531
margin: auto;
2632
text-align: center;
27-
font: var(--font-dm-m);
2833
}
2934

3035

@@ -33,19 +38,27 @@
3338
gap: 20px;
3439

3540
}
41+
.Header{
42+
background-color: #1E3544;
43+
box-shadow: 0.3rem 0.3rem black;
44+
border: 2px solid black;
45+
border-radius: 5px;
46+
margin-bottom: 20px;
47+
padding: 20px;
48+
margin-inline:0;
49+
}
3650

3751
.Title {
38-
font: var(--font-sw-xxxl);
52+
font: var(--font-sw-xl);
53+
margin-bottom: .2em;
3954
color: var(--primary-color);
40-
line-height: 1.5;
41-
text-align: center;
4255
}
4356

4457
.InfoText {
45-
width: 85%;
46-
margin: 40px auto;
47-
text-align: center;
58+
margin-top: 10px;
59+
display:inline;
4860
font: var(--font-dm-m);
61+
color: #faf9f6c0;
4962
}
5063

5164

@@ -54,6 +67,7 @@
5467
gap: 30px;
5568
justify-content: center;
5669
flex-wrap: wrap;
70+
5771
}
5872

5973
@media (min-width: breakpoint(md)) {
@@ -62,7 +76,6 @@
6276

6377
.SocialsText {
6478
width: 75%;
65-
font: var(--font-dm-m);
6679
}
6780
}
6881

@@ -73,13 +86,6 @@
7386

7487
}
7588

76-
@media (max-width: 480px) {
77-
.Title {
78-
font: var(--font-sw-xxl);
79-
}
80-
81-
}
82-
8389
.videoWrapper{
8490
padding: 0 40px;
8591
margin-bottom: 20px;
@@ -92,5 +98,37 @@
9298
border-radius: var(--border-radius-custom);
9399
}
94100

101+
.TitleBar {
102+
display: flex;
103+
justify-content: space-between;
104+
align-items: center;
105+
margin-inline: 1rem;
106+
}
95107

108+
.SearchBarDesktop {
109+
width: 200px;
110+
}
111+
112+
.short {
113+
width: 17.5rem;
114+
@media (max-width: breakpoint(lg)){
115+
margin-inline: auto;
116+
}
117+
@media (max-width: breakpoint(md)){
118+
width: 100%;
119+
margin-inline: 0;
120+
}
121+
}
122+
123+
124+
125+
@media (max-width: breakpoint(lg)) {
126+
.mainTitle{
127+
text-align: center;
128+
font: var(--font-sw-xxl);
129+
}
130+
.Maincontainer{
131+
width: 100%;
132+
}
96133

134+
}

0 commit comments

Comments
 (0)