Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEVREL-934 New model rewrite #36

Merged
merged 43 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
3cf66e4
regenerate models
Aug 15, 2023
8b5395f
fix build for new model (still TODOS)
Aug 15, 2023
b772f9b
add resolutionlogic + tests
Aug 17, 2023
61cdae2
fix modelGenerator icon
Aug 17, 2023
370d535
adjust to content model
Aug 17, 2023
096eb7c
include test to pipeline
Aug 17, 2023
0cbbcf5
adjust lint
Aug 17, 2023
adecdaa
adjust routing for categories
Aug 17, 2023
44cc7db
extend Fact to chold data and reference info altogether
Aug 17, 2023
4c62df0
add todo message
Aug 17, 2023
1584acd
remove titie&message snippet and rename content type groups guidelines
Aug 17, 2023
d0f4b4a
rewrite url definitions
Aug 17, 2023
1c7e013
slight adjustments
Aug 18, 2023
f528b18
extend data fetching for default collection
Aug 18, 2023
3e19769
fix build errors after merge
Aug 18, 2023
ea36d85
prepare for surgical updates
Aug 18, 2023
f4f0a48
accomodate new article categories
Aug 21, 2023
8f3029c
remodel-products
Aug 21, 2023
9fc8b40
rename to ficto surgical - remove healthtech from name
Aug 21, 2023
2a5d079
fix build
Aug 21, 2023
e7adb69
redesign, add solutions route and support for Solution type
pokornyd Aug 23, 2023
29cb1d0
refactor, add anchor support, smooth scrolling
pokornyd Aug 23, 2023
37868ef
--amend
pokornyd Aug 24, 2023
2b658b0
add css transition only for link facts
Aug 24, 2023
85a6534
extract rich text to separate component
Aug 24, 2023
431c619
extract anchor logic
Aug 24, 2023
dcb26a8
rewrite css
Aug 24, 2023
b99451b
unify color schemes
pokornyd Aug 24, 2023
1e1d1df
add dynamic anchor color, adjust styling
pokornyd Aug 29, 2023
becd9f8
fix tests
Aug 29, 2023
ca36ac7
regenerate models
Sep 4, 2023
d704e19
set menu background all the time - easies fix for now
Sep 4, 2023
fd64f2a
fixum desgn of listing and details for articles and products
Sep 4, 2023
5c3eb80
use middleware to reduce code duplication
Sep 6, 2023
d20670e
fix stykling issues on article listing
Sep 6, 2023
ed8af5a
DEVREL-934 Make some cosmetic changes
JiriLojda Sep 7, 2023
b963b1b
simplify middleware logic
Sep 7, 2023
a15064e
removed unused component
Sep 7, 2023
d14ee7b
review comments
Sep 7, 2023
4adb9aa
remove unnecessary filter + tune up css for article listing
Sep 11, 2023
283190c
DEVREL-934 Merge imports in middleware
JiriLojda Sep 11, 2023
bc618ae
unify query string building logic
Sep 11, 2023
366d0fa
cosmetics
Sep 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env.local.template
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
APP_VERSION=$npm_package_version
APP_NAME=$npm_package_name
NEXT_PUBLIC_KONTENT_ENVIRONMENT_ID=2cedc519-a547-01ba-dde7-b01e00b909a1
KONTENT_COLLECTION_CODENAME=ficto_healthtech_surgical
# Domain for other collection links in format <COLLECTION_CODENAME>:<DOMAIN_WITOUHOUT_PROTOCOL> i.e. "ficto_healthtech_imaging:ficto-healthtech-imaging.vercel.app,ficto_healthtech_surgical:ficto-healthtech-surgical.vercel.app
KONTENT_COLLECTION_CODENAME=ficto_surgical
# Domain for other collection links in format <COLLECTION_CODENAME>:<DOMAIN_WITOUHOUT_PROTOCOL> i.e. "ficto_healthtech_imaging:ficto-healthtech-imaging.vercel.app,ficto_surgical:ficto-healthtech-surgical.vercel.app
NEXT_PUBLIC_OTHER_COLLECTIONS_DOMAINS=
KONTENT_PREVIEW_API_KEY=
KONTENT_MANAGEMENT_API_KEY=
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Lint & Test

on:
push:
Expand All @@ -11,12 +11,12 @@ jobs:

steps:
- uses: actions/checkout@v2

id: nvm
- name: Use Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- run: npm ci
- run: npm run lint
- run: npm run test

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Ficto Healthtech Imaging

[![Vercel](https://therealsujitk-vercel-badge.vercel.app/?app=health-tech-imaging&style=for-the-badge&logo=false)](https://ficto-healthtech-imaging.vercel.app)

Ficto Healthtech Surgical
Ficto Surgical

[![Vercel](https://therealsujitk-vercel-badge.vercel.app/?app=health-tech-surgical&style=for-the-badge&logo=false)](https://ficto-healthtech-surgical.vercel.app)

Expand Down
52 changes: 33 additions & 19 deletions components/landingPage/ui/heroImage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import Image from 'next/image';
import Image from "next/image";
import { FC, ReactNode } from "react";

import { mainColorMdBgClass } from "../../../lib/constants/colors";
import { createItemSmartLink } from "../../../lib/utils/smartLinkUtils";
import { useSiteCodename } from "../../shared/siteCodenameContext";

type Props = Readonly<{
url: string;
Expand All @@ -10,23 +12,35 @@ type Props = Readonly<{
itemId?: string;
}>;

export const HeroImage: FC<Props> = props => (
<figure
className={`relative m-0 w-full h-screen md:h-[36rem] ${props.className ?? ""}`}
{...createItemSmartLink(props.itemId)}
>
<Image
src={props.url}
alt="Hero image"
fill
className="object-cover"
sizes="(max-width: 1200px) 100vw, 80vw"
priority
/>
<div className="relative w-fit h-full flex flex-col items-center md:items-start justify-end pb-32 md:pb-12 px-6">
{props.children}
</div>
</figure>
);
export const HeroImage: FC<Props> = (props) => {
const siteCodename = useSiteCodename();

return (
<>
<figure
className={`relative m-0 justify-start not-prose w-screen h-screen max-h-[1200px] ${
props.className ?? ""
}`}
{...createItemSmartLink(props.itemId)}
>
<div className="absolute inset-0 [margin-left:-38%]">
<Image
src={props.url}
alt="Hero image"
fill
className="object-cover"
sizes="(max-width: 1200px) 100vw, 80vw"
priority
/>
</div>
<div
className={`${mainColorMdBgClass[siteCodename]} relative w-fit h-full flex max-w-3xl flex-col items-center md:items-start justify-end min-[900px]:justify-center pt-20 pb-32 md:pb-12 pr-6 min-[900px]:px-6`}
>
{props.children}
</div>
</figure>
</>
);
};

HeroImage.displayName = "HeroImage";
106 changes: 54 additions & 52 deletions components/listingPage/ArticleItem.tsx
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
import Image from "next/image"
import Link from "next/link";
import { FC } from "react";

import { mainColorBgClass, mainColorTextClass } from "../../lib/constants/colors";
import { formatDate } from "../../lib/utils/dateTime";
import { useSiteCodename } from "../shared/siteCodenameContext";
import { StandaloneSmartLinkButton } from "../shared/StandaloneSmartLinkButton";

type Props = Readonly<{
imageUrl: string;
title: string;
detailUrl: string;
description: string,
publisingDate: string | null,
itemId?: string;
}>;

export const ArticleItem: FC<Props> = props => {
const siteCodename = useSiteCodename()

return (
<li className="m-0 p-0 relative md:rounded-lg shadow hover:shadow-xl transition-shadow border border-gray-200 cursor-pointer">
<Link
href={props.detailUrl}
className="no-underline"
>
<StandaloneSmartLinkButton itemId={props.itemId} />
<figure className="w-full relative m-0 h-40">
<Image
src={props.imageUrl}
alt={props.title}
fill
sizes="(max-width: 635px) 100vw, (max-width: 1275px) 50vw, 25vw"
className="object-cover h-full m-0 p-0 md:rounded-t-lg"
/>
</figure>
{props.publisingDate && (
<div className="w-fit p-2 bg-gray-800 text-white opacity-90 font-normal line-clamp-6 absolute right-0 translate-y-[-100%]">
<p className="m-0 w-fit">{formatDate(props.publisingDate)}</p>
</div>
)}
<div className="p-5">
<h5 className="mb-2 text-xl font-bold tracking-tight text-gray-900 no-underline line-clamp-2 ">{props.title}</h5>
<p className="mb-0 font-normal text-gray-700 line-clamp-6">{props.description}</p>
</div>
<button className={`${mainColorTextClass} block ml-auto w-fit mb-3 mr-4 font-semibold line-clamp-6 hover:bg-transparent border ${mainColorBgClass[siteCodename]} py-2 px-4 md:rounded`}>Continue reading</button>
</Link>
</li>
);
}

import Image from "next/image"
import Link from "next/link";
import { FC } from "react";

import { mainColorButtonClass, mainColorGroupHoverClass } from "../../lib/constants/colors";
import { formatDate } from "../../lib/utils/dateTime";
import { useSiteCodename } from "../shared/siteCodenameContext";
import { StandaloneSmartLinkButton } from "../shared/StandaloneSmartLinkButton";

type Props = Readonly<{
imageUrl: string;
title: string;
detailUrl: string;
description: string,
publishingDate: string | null,
itemId?: string;
}>;

export const ArticleItem: FC<Props> = props => {
const siteCodename = useSiteCodename()

return (
<li className="m-0 p-0 relative md:rounded-lg shadow hover:shadow-xl transition-shadow border border-gray-200 cursor-pointer">
<Link
href={props.detailUrl}
className="no-underline group"
>
<StandaloneSmartLinkButton itemId={props.itemId} />
<figure className="w-full relative m-0 h-40">
<Image
src={props.imageUrl}
alt={props.title}
fill
sizes="(max-width: 635px) 100vw, (max-width: 1275px) 50vw, 25vw"
className="object-cover h-full m-0 p-0 md:rounded-t-lg"
/>
</figure>
{props.publishingDate && (
<div className="w-fit p-2 bg-gray-800 text-white opacity-90 font-normal line-clamp-6 absolute right-0 translate-y-[-100%]">
<p className="m-0 w-fit">{formatDate(props.publishingDate)}</p>
</div>
)}
<div className="p-5">
<h5 className="mb-2 text-xl font-bold tracking-tight text-gray-900 no-underline line-clamp-2 ">{props.title}</h5>
<p className="mb-0 font-normal text-gray-700 line-clamp-6">{props.description}</p>
</div>
<button className={`${mainColorGroupHoverClass[siteCodename]} ${mainColorButtonClass[siteCodename]} block ml-auto w-fit mb-3 mr-4 font-semibold line-clamp-6 border text-white py-2 px-4 md:rounded`}>
<span>Continue reading</span>
</button>
</Link>
</li>
);
}

ArticleItem.displayName = "ListItem";
96 changes: 48 additions & 48 deletions components/listingPage/ProductItem.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
import Image from "next/image"
import Link from "next/link";
import { FC } from "react";

import { mainColorBgClass, mainColorTextClass } from "../../lib/constants/colors";
import { useSiteCodename } from "../shared/siteCodenameContext";
import { StandaloneSmartLinkButton } from "../shared/StandaloneSmartLinkButton";

type Props = Readonly<{
imageUrl: string;
title: string;
detailUrl: string;
price: number | null;
category: string,
itemId?: string;
}>;

export const ProductItem: FC<Props> = props => {
const siteCodename = useSiteCodename()

return (
<li className="min-w-full m-0 p-0 relative rounded-lg shadow hover:shadow-xl transition-shadow border border-gray-200 cursor-pointer min-h-full">
<Link
href={props.detailUrl}
className="no-underline p-0 m-0"
>
<StandaloneSmartLinkButton itemId={props.itemId} />

<div className="flex flex-col gap-2">
<h5 className="px-4 pt-2 mt-2 text-center text-xl tracking-wider font-semibold text-gray-900">{props.title}</h5>
<p className="m-0 text-center text-gray-500 text-base">{props.category}</p>
<figure className="w-full relative m-0 h-40">
<Image
src={props.imageUrl}
alt={props.title}
fill
sizes="(max-width: 635px) 100vw, (max-width: 1534px) 50vw, 25vw"
className="object-contain h-full w-full m-0 p-0 rounded-t-lg"
/>
</figure>
{props.price && <p className="m-0 text-center text-xl font-normal pb-2">{`${props.price}€`}</p>}
<button className={`${mainColorTextClass} block ml-auto w-fit mb-3 mr-4 font-semibold line-clamp-6 hover:bg-transparent border ${mainColorBgClass[siteCodename]} py-2 px-4 rounded`}>Detail</button>
</div>
</Link>
</li>
);
}

import Image from "next/image"
import Link from "next/link";
import { FC } from "react";
import { mainColorButtonClass, mainColorGroupHoverClass } from "../../lib/constants/colors";
import { useSiteCodename } from "../shared/siteCodenameContext";
import { StandaloneSmartLinkButton } from "../shared/StandaloneSmartLinkButton";
type Props = Readonly<{
imageUrl: string;
title: string;
detailUrl: string;
price: number | null;
category: string,
itemId?: string;
}>;
export const ProductItem: FC<Props> = props => {
const siteCodename = useSiteCodename()
return (
<li className="min-w-full m-0 p-0 relative rounded-lg shadow hover:shadow-xl transition-shadow border border-gray-200 cursor-pointer min-h-full">
<Link
href={props.detailUrl}
className="group no-underline p-0 m-0"
>
<StandaloneSmartLinkButton itemId={props.itemId} />
<div className="flex flex-col gap-2">
<h5 className="px-4 pt-2 mt-2 text-center text-xl tracking-wider font-semibold text-gray-900">{props.title}</h5>
<p className="m-0 text-center text-gray-500 text-base">{props.category}</p>
<figure className="w-full relative m-0 h-40">
<Image
src={props.imageUrl}
alt={props.title}
fill
sizes="(max-width: 635px) 100vw, (max-width: 1534px) 50vw, 25vw"
className="object-contain h-full w-full m-0 p-0 rounded-t-lg"
/>
</figure>
{props.price && <p className="m-0 text-center text-xl font-normal pb-2">{`${props.price}€`}</p>}
<button className={`${mainColorGroupHoverClass[siteCodename]} ${mainColorButtonClass[siteCodename]} text-white block ml-auto w-fit mb-3 mr-4 font-semibold line-clamp-6 hover:bg-transparent border py-2 px-4 rounded`}>Detail</button>
</div>
</Link>
</li>
);
}
ProductItem.displayName = "ListItem";
16 changes: 5 additions & 11 deletions components/shared/Content.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { ComponentType, FC } from "react";

import { Block_ContentChunk, Block_HeroUnit, Block_VisualContainer, contentTypes,Testimonial } from "../../models";
import { HeroUnitComponent } from "./HeroUnit";
import { RichTextContentComponent } from "./RichTextContent";
import { TestimonialComponent } from "./Testimonial";
import { Block_ContentChunk, Block_VisualContainer, contentTypes } from "../../models";
import { ContentChunk as ContentChunk } from "./ContentChunk";
import { VisualContainer } from "./visualContainer/VisualContainer";

type AcceptedType = AcceptedTypesByCodename[keyof AcceptedTypesByCodename];
Expand All @@ -27,17 +25,13 @@ export const Content: FC<Props> = props => {
}

const componentMap: Readonly<{ [key in keyof AcceptedTypesByCodename]: ComponentType<Readonly<{ item: AcceptedTypesByCodename[key] }>> }> = {
hero_unit: HeroUnitComponent,
content_chunk: RichTextContentComponent,
testimonial: TestimonialComponent,
_visual_container: VisualContainer,
content_chunk: ContentChunk,
visual_container: VisualContainer,
};

// Unfortunately, we need to define the relationship manually, because the generator doesn't define it itself. :/
type AcceptedTypesByCodename = {
[contentTypes.hero_unit.codename]: Block_HeroUnit;
[contentTypes.content_chunk.codename]: Block_ContentChunk;
[contentTypes.testimonial.codename]: Testimonial;
[contentTypes._visual_container.codename]: Block_VisualContainer;
[contentTypes.visual_container.codename]: Block_VisualContainer;
};

33 changes: 33 additions & 0 deletions components/shared/ContentChunk.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { FC } from "react";

import {
createElementSmartLink,
createFixedAddSmartLink,
createItemSmartLink,
} from "../../lib/utils/smartLinkUtils";
import {
Block_ContentChunk,
contentTypes,
} from "../../models";
import { RichTextElement } from "./richText/RichTextElement";

type Props = Readonly<{
item: Block_ContentChunk;
}>;

export const ContentChunk: FC<Props> = (props) => (
<div
className="px-10 py-5 vis-container"
{...createItemSmartLink(props.item.system.id)}
{...createElementSmartLink(
contentTypes.content_chunk.elements.content.codename
)}
{...createFixedAddSmartLink("end")}
>
<RichTextElement
element={props.item.elements.content}
isInsideTable={false}
/>
</div>
);

Loading
Loading