Skip to content

Commit edf62b2

Browse files
committed
fixed conflicts
1 parent ab490fc commit edf62b2

5 files changed

Lines changed: 32084 additions & 165 deletions

File tree

frontend/app/[locale]/blog/[slug]/PostDetails.tsx

Lines changed: 26 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -43,43 +43,46 @@ function plainTextFromPortableText(value: any): string {
4343
.trim();
4444
}
4545

46+
function seededShuffle<T>(items: T[], seed: number) {
47+
const result = [...items];
48+
let value = seed;
49+
for (let i = result.length - 1; i > 0; i -= 1) {
50+
value = (value * 1664525 + 1013904223) % 4294967296;
51+
const j = value % (i + 1);
52+
[result[i], result[j]] = [result[j], result[i]];
53+
}
54+
return result;
55+
}
56+
57+
function hashString(input: string) {
58+
let hash = 0;
59+
for (let i = 0; i < input.length; i += 1) {
60+
hash = (hash * 31 + input.charCodeAt(i)) >>> 0;
61+
}
62+
return hash;
63+
}
64+
4665
const query = groq`
4766
*[_type=="post" && slug.current==$slug][0]{
48-
<<<<<<< HEAD
4967
_id,
5068
"title": coalesce(title[$locale], title[lower($locale)], title.uk, title.en, title.pl, title),
51-
=======
52-
"title": coalesce(title[$locale], title.en, title),
53-
>>>>>>> develop
5469
publishedAt,
5570
"mainImage": mainImage.asset->url,
5671
"categories": categories[]->title,
5772
tags,
5873
resourceLink,
5974
6075
"author": author->{
61-
<<<<<<< HEAD
6276
"name": coalesce(name[$locale], name[lower($locale)], name.uk, name.en, name.pl, name),
6377
"company": coalesce(company[$locale], company[lower($locale)], company.uk, company.en, company.pl, company),
6478
"jobTitle": coalesce(jobTitle[$locale], jobTitle[lower($locale)], jobTitle.uk, jobTitle.en, jobTitle.pl, jobTitle),
6579
"city": coalesce(city[$locale], city[lower($locale)], city.uk, city.en, city.pl, city),
6680
"bio": coalesce(bio[$locale], bio[lower($locale)], bio.uk, bio.en, bio.pl, bio),
67-
=======
68-
"name": coalesce(name[$locale], name.en, name),
69-
"company": coalesce(company[$locale], company.en, company),
70-
"jobTitle": coalesce(jobTitle[$locale], jobTitle.en, jobTitle),
71-
"city": coalesce(city[$locale], city.en, city),
72-
"bio": coalesce(bio[$locale], bio.en, bio),
73-
>>>>>>> develop
7481
"image": image.asset->url,
7582
socialMedia[]{ _key, platform, url }
7683
},
7784
78-
<<<<<<< HEAD
7985
"body": coalesce(body[$locale], body[lower($locale)], body.uk, body.en, body.pl, body)[]{
80-
=======
81-
"body": coalesce(body[$locale], body.en, body)[]{
82-
>>>>>>> develop
8386
...,
8487
_type == "image" => {
8588
...,
@@ -117,16 +120,14 @@ export default async function PostDetails({
117120
slug: slugParam,
118121
locale,
119122
});
120-
<<<<<<< HEAD
121123
const recommendedAll: Post[] = await client.fetch(recommendedQuery, {
122124
slug: slugParam,
123125
locale,
124126
});
125-
const recommendedPosts = recommendedAll
126-
.sort(() => Math.random() - 0.5)
127-
.slice(0, 3);
128-
=======
129-
>>>>>>> develop
127+
const recommendedPosts = seededShuffle(
128+
recommendedAll,
129+
hashString(slugParam)
130+
).slice(0, 3);
130131

131132
if (!post?.title) return notFound();
132133

@@ -187,18 +188,18 @@ export default async function PostDetails({
187188
)}
188189

189190
<article className="prose prose-gray max-w-none">
190-
{post.body?.map((block: any) => {
191+
{post.body?.map((block: any, index: number) => {
191192
if (block?._type === 'block') {
192193
const text = (block.children || [])
193194
.map((c: any) => c.text || '')
194195
.join('');
195-
return <p key={block._key || Math.random()}>{text}</p>;
196+
return <p key={block._key || `block-${index}`}>{text}</p>;
196197
}
197198

198199
if (block?._type === 'image' && block?.url) {
199200
return (
200201
<img
201-
key={block._key || block.url}
202+
key={block._key || `image-${index}`}
202203
src={block.url}
203204
alt={post.title || 'Post image'}
204205
className="rounded-xl border border-gray-200 my-6"
@@ -268,45 +269,9 @@ export default async function PostDetails({
268269
</>
269270
)}
270271

271-
<<<<<<< HEAD
272272
{post.resourceLink && null}
273273

274274
{(authorBio || authorName || authorMeta) && null}
275-
=======
276-
{(authorBio || authorName || authorMeta) && (
277-
<section className="mt-12 p-6 rounded-2xl border border-gray-200 bg-white">
278-
<h2 className="text-lg font-semibold">{t('aboutAuthor')}</h2>
279-
<div className="mt-4 flex items-start gap-4">
280-
{post.author?.image && (
281-
<div className="relative w-14 h-14 shrink-0">
282-
<Image
283-
src={post.author.image}
284-
alt={authorName || 'Author'}
285-
fill
286-
className="rounded-full object-cover border border-gray-200"
287-
/>
288-
</div>
289-
)}
290-
291-
<div className="min-w-0">
292-
{authorName && (
293-
<p className="text-sm font-semibold text-gray-900">
294-
{authorName}
295-
</p>
296-
)}
297-
{authorMeta && (
298-
<p className="mt-1 text-sm text-gray-600">{authorMeta}</p>
299-
)}
300-
{authorBio && (
301-
<p className="mt-3 text-sm text-gray-700 whitespace-pre-line leading-relaxed">
302-
{authorBio}
303-
</p>
304-
)}
305-
</div>
306-
</div>
307-
</section>
308-
)}
309-
>>>>>>> develop
310275
</main>
311276
);
312277
}

frontend/app/[locale]/blog/page.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,43 +30,27 @@ export default async function BlogPage({
3030
*[_type == "post" && defined(slug.current)]
3131
| order(publishedAt desc) {
3232
_id,
33-
<<<<<<< HEAD
3433
"title": coalesce(title[$locale], title[lower($locale)], title.uk, title.en, title.pl, title),
35-
=======
36-
"title": coalesce(title[$locale], title.en, title),
37-
>>>>>>> develop
3834
slug,
3935
publishedAt,
4036
tags,
4137
resourceLink,
4238
4339
"categories": categories[]->title,
4440
45-
<<<<<<< HEAD
4641
"body": coalesce(body[$locale], body[lower($locale)], body.uk, body.en, body.pl, body)[]{
47-
=======
48-
"body": coalesce(body[$locale], body.en, body)[]{
49-
>>>>>>> develop
5042
...,
5143
children[]{
5244
text
5345
}
5446
},
5547
"mainImage": mainImage.asset->url,
5648
"author": author->{
57-
<<<<<<< HEAD
5849
"name": coalesce(name[$locale], name[lower($locale)], name.uk, name.en, name.pl, name),
5950
"company": coalesce(company[$locale], company[lower($locale)], company.uk, company.en, company.pl, company),
6051
"jobTitle": coalesce(jobTitle[$locale], jobTitle[lower($locale)], jobTitle.uk, jobTitle.en, jobTitle.pl, jobTitle),
6152
"city": coalesce(city[$locale], city[lower($locale)], city.uk, city.en, city.pl, city),
6253
"bio": coalesce(bio[$locale], bio[lower($locale)], bio.uk, bio.en, bio.pl, bio),
63-
=======
64-
"name": coalesce(name[$locale], name.en, name),
65-
"company": coalesce(company[$locale], company.en, company),
66-
"jobTitle": coalesce(jobTitle[$locale], jobTitle.en, jobTitle),
67-
"city": coalesce(city[$locale], city.en, city),
68-
"bio": coalesce(bio[$locale], bio.en, bio),
69-
>>>>>>> develop
7054
"image": image.asset->url,
7155
socialMedia[]{
7256
_key,
@@ -78,7 +62,6 @@ export default async function BlogPage({
7862
`,
7963
{ locale }
8064
);
81-
<<<<<<< HEAD
8265
const categories = await client.fetch(
8366
groq`
8467
*[_type == "category"] | order(orderRank asc) {
@@ -88,8 +71,6 @@ export default async function BlogPage({
8871
`
8972
);
9073
const featuredPost = posts?.[0];
91-
=======
92-
>>>>>>> develop
9374

9475
return (
9576
<main className="max-w-6xl mx-auto px-6 py-12">

frontend/components/blog/BlogCard.tsx

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@
33
import { useMemo } from 'react';
44
import Image from 'next/image';
55
import Link from 'next/link';
6-
<<<<<<< HEAD
76
import { useLocale, useTranslations } from 'next-intl';
87
import type {
98
Author,
109
Post,
1110
PortableTextBlock,
1211
PortableTextSpan,
1312
} from './BlogFilters';
14-
=======
15-
import { useTranslations } from 'next-intl';
16-
import AuthorModal from './AuthorModal';
17-
import type { Post, PortableTextBlock, PortableTextSpan } from './BlogFilters';
18-
>>>>>>> develop
1913

2014
export default function BlogCard({
2115
post,
@@ -56,12 +50,7 @@ export default function BlogCard({
5650
overflow-visible
5751
flex flex-col
5852
h-full
59-
<<<<<<< HEAD
6053
transition
61-
=======
62-
transition-transform
63-
hover:-translate-y-[2px]
64-
>>>>>>> develop
6554
"
6655
>
6756
{post.mainImage && (
@@ -73,25 +62,16 @@ export default function BlogCard({
7362
rounded-lg
7463
bg-gray-100
7564
shadow-[0_8px_24px_rgba(0,0,0,0.08)]
76-
<<<<<<< HEAD
7765
dark:border dark:border-[rgba(56,189,248,0.25)]
7866
dark:shadow-[0_0_0_1px_rgba(56,189,248,0.25),0_12px_28px_rgba(56,189,248,0.18)]
7967
transition-transform duration-300
80-
=======
81-
transition-transform duration-300
82-
group-hover:translate-y-[-2px]
83-
>>>>>>> develop
8468
"
8569
>
8670
<Image
8771
src={post.mainImage}
8872
alt={post.title}
8973
fill
90-
<<<<<<< HEAD
9174
className="object-cover brightness-95 contrast-110 scale-[1.03] transition-transform duration-300 group-hover:scale-[1.06]"
92-
=======
93-
className="object-cover grayscale brightness-95 contrast-110 scale-[1.03]"
94-
>>>>>>> develop
9575
priority={false}
9676
/>
9777
</Link>
@@ -102,19 +82,11 @@ export default function BlogCard({
10282
href={`/blog/${post.slug.current}`}
10383
className="
10484
block
105-
<<<<<<< HEAD
10685
text-[22px] md:text-[26px]
10786
font-semibold
10887
tracking-tight
10988
leading-[1.2]
11089
text-gray-950 dark:text-gray-100
111-
=======
112-
text-[20px] md:text-[22px]
113-
font-semibold
114-
tracking-tight
115-
leading-[1.25]
116-
text-gray-950
117-
>>>>>>> develop
11890
transition
11991
hover:text-[#ff00ff]
12092
hover:underline
@@ -128,17 +100,12 @@ export default function BlogCard({
128100
</Link>
129101

130102
{excerpt && (
131-
<<<<<<< HEAD
132103
<p className="mt-4 text-[16px] md:text-[17px] leading-[1.65] text-gray-700 dark:text-gray-300 max-w-[60ch] line-clamp-3">
133-
=======
134-
<p className="mt-4 text-[15px] md:text-[16px] leading-[1.7] text-gray-700 max-w-[60ch] line-clamp-3">
135-
>>>>>>> develop
136104
{excerpt}
137105
</p>
138106
)}
139107

140108
<div className="mt-auto pt-6">
141-
<<<<<<< HEAD
142109
{post.author?.name && (
143110
<div className="mb-3 flex items-center gap-2 text-[13px] md:text-[14px] text-gray-500 dark:text-gray-400">
144111
<button
@@ -164,58 +131,6 @@ export default function BlogCard({
164131
)}
165132

166133
{post.resourceLink && null}
167-
=======
168-
{post.author && (
169-
<div className="mb-3">
170-
<AuthorModal
171-
author={post.author}
172-
publishedAt={post.publishedAt}
173-
/>
174-
</div>
175-
)}
176-
177-
{post.tags?.length ? (
178-
<div className="flex flex-wrap gap-3">
179-
{post.tags.map((tag, i) => {
180-
const norm = tag.toLowerCase();
181-
const active = selectedTags.includes(norm);
182-
183-
return (
184-
<button
185-
key={`${norm}-${i}`}
186-
onClick={() => onTagToggle(norm)}
187-
className={[
188-
'text-[13px] text-gray-400 transition underline-offset-4',
189-
active
190-
? 'text-gray-950 underline'
191-
: 'hover:text-[#ff00ff] hover:underline',
192-
].join(' ')}
193-
>
194-
#{norm}
195-
</button>
196-
);
197-
})}
198-
</div>
199-
) : null}
200-
201-
{post.resourceLink && (
202-
<a
203-
href={post.resourceLink}
204-
target="_blank"
205-
rel="noopener noreferrer"
206-
className="
207-
mt-5 inline-flex
208-
text-[13px] font-medium
209-
text-gray-700
210-
hover:text-[#ff00ff]
211-
hover:underline
212-
underline-offset-4
213-
"
214-
>
215-
{t('readArticle')}
216-
</a>
217-
)}
218-
>>>>>>> develop
219134
</div>
220135
</div>
221136
</article>

0 commit comments

Comments
 (0)