mirror of
https://github.com/samkaraca/lazuri-doviguram.git
synced 2026-04-29 17:59:51 +00:00
website template introduced
This commit is contained in:
parent
977d701c09
commit
4692487e1e
@ -3,7 +3,13 @@ import styles from "./app_bar.module.scss";
|
||||
import { MenuRounded } from "@mui/icons-material";
|
||||
import { useState } from "react";
|
||||
|
||||
export function AppBar({ home }: { home: "/admin" | "/" }) {
|
||||
export function AppBar({
|
||||
home,
|
||||
pageTemplate,
|
||||
}: {
|
||||
home: "/admin" | "/";
|
||||
pageTemplate: IndexPageTemplate;
|
||||
}) {
|
||||
const [isAltMenuOpen, setIsAltMenuOpen] = useState(false);
|
||||
|
||||
return (
|
||||
@ -11,24 +17,16 @@ export function AppBar({ home }: { home: "/admin" | "/" }) {
|
||||
<header className={styles["header"]}>
|
||||
<div>
|
||||
<Link className={styles["header-logo"]} href={home}>
|
||||
<img src="/header-logo.png" alt="" />
|
||||
<img src={pageTemplate.logoUrl} alt="" />
|
||||
</Link>
|
||||
<nav>
|
||||
<a className="simple" href={`${home}#temalar`}>
|
||||
Temalar
|
||||
</a>
|
||||
<a
|
||||
className="simple"
|
||||
href="https://drive.google.com/file/d/1ogVdEciTUea-WW0jvXmXGF25cEpW8c2F/view"
|
||||
>
|
||||
Ders Kitabı
|
||||
</a>
|
||||
<a className="simple" href="https://www.lazcasozluk.org/">
|
||||
Sözlük
|
||||
</a>
|
||||
<a className="simple" href="https://www.lazenstitu.com/">
|
||||
Laz Enstitüsü
|
||||
</a>
|
||||
{pageTemplate.headerNavigationItems.map((item) => {
|
||||
return (
|
||||
<a className="simple" href={item.link} key={item.title}>
|
||||
{item.title}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
<button
|
||||
onClick={() => setIsAltMenuOpen((prev) => !prev)}
|
||||
@ -44,21 +42,13 @@ export function AppBar({ home }: { home: "/admin" | "/" }) {
|
||||
aria-label="navigasyon menüsü"
|
||||
>
|
||||
<nav>
|
||||
<a className="simple" href={`${home}#temalar`}>
|
||||
Temalar
|
||||
</a>
|
||||
<a
|
||||
className="simple"
|
||||
href="https://drive.google.com/file/d/1ogVdEciTUea-WW0jvXmXGF25cEpW8c2F/view"
|
||||
>
|
||||
Ders Kitabı
|
||||
</a>
|
||||
<a className="simple" href="https://www.lazcasozluk.org/">
|
||||
Sözlük
|
||||
</a>
|
||||
<a className="simple" href="https://www.lazenstitu.com/">
|
||||
Laz Enstitüsü
|
||||
</a>
|
||||
{pageTemplate.headerNavigationItems.map((item) => {
|
||||
return (
|
||||
<a className="simple" href={item.link} key={item.title}>
|
||||
{item.title}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</section>
|
||||
</>
|
||||
|
||||
@ -2,7 +2,6 @@ import { AppBar } from "../app_bar";
|
||||
import { ThemesSection } from "./themes_section/themes_section";
|
||||
import { WelcomeSection } from "./welcome_section/welcome_section";
|
||||
import { Footer } from "../footer";
|
||||
import Head from "next/head";
|
||||
import { ReactNode } from "react";
|
||||
import { ThemeMetaDTO } from "@/lib/theme/theme_meta_dto";
|
||||
|
||||
@ -10,18 +9,17 @@ export function LandingPageView({
|
||||
themePreviews,
|
||||
home = "/",
|
||||
createNewThemeButton,
|
||||
pageTemplate,
|
||||
}: {
|
||||
themePreviews: ThemeMetaDTO[];
|
||||
home: "/admin" | "/";
|
||||
createNewThemeButton?: ReactNode;
|
||||
pageTemplate: IndexPageTemplate;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Lazuri Doviguram!</title>
|
||||
</Head>
|
||||
<AppBar home={home} />
|
||||
<WelcomeSection />
|
||||
<AppBar home={home} pageTemplate={pageTemplate} />
|
||||
<WelcomeSection pageTemplate={pageTemplate} />
|
||||
<ThemesSection
|
||||
home={home}
|
||||
themePreviews={themePreviews}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
import styles from "./welcome_section.module.scss";
|
||||
|
||||
export function WelcomeSection() {
|
||||
export function WelcomeSection({
|
||||
pageTemplate,
|
||||
}: {
|
||||
pageTemplate: IndexPageTemplate;
|
||||
}) {
|
||||
return (
|
||||
<section className={styles["welcome"]}>
|
||||
<div>
|
||||
<h1>Lazuri Doviguram!</h1>
|
||||
<p>
|
||||
Tarihin en eski dönemlerinden beri Kafkas insanının duygularına
|
||||
tercüman olmuş, yaşamlarına eşlik etmiş bir dili, daha yakından
|
||||
tanımak ister misin?
|
||||
</p>
|
||||
<h1>{pageTemplate.welcomeHeadline}</h1>
|
||||
<p>{pageTemplate.welcomeText}</p>
|
||||
<button
|
||||
className="simple"
|
||||
onClick={() => {
|
||||
@ -20,7 +20,7 @@ export function WelcomeSection() {
|
||||
>
|
||||
Öğrenmeye Başla
|
||||
</button>
|
||||
<img src="/reading-kid.png" />
|
||||
<img src={pageTemplate.welcomeImageUrl} />
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
import { DynamoDBClientSingleton } from "@/lib/utils/dynamo_db_client_singleton";
|
||||
import { GetItemCommand } from "@aws-sdk/client-dynamodb";
|
||||
import { marshall, unmarshall } from "@aws-sdk/util-dynamodb";
|
||||
import { IWebsitePageTemplateRepository } from "./website_page_template_repository";
|
||||
import { IndexPageTemplate } from "@/lib/types/website_page_templates/index_page_template";
|
||||
import { ApiResponse } from "@/lib/types/api_response";
|
||||
|
||||
const dynamoDB = DynamoDBClientSingleton.getInstance();
|
||||
|
||||
export class DynamoDBWebsitePageTemplateRepository
|
||||
implements IWebsitePageTemplateRepository
|
||||
{
|
||||
getIndexPageTemplate = async (): Promise<ApiResponse<IndexPageTemplate>> => {
|
||||
try {
|
||||
const command = new GetItemCommand({
|
||||
TableName: "themes",
|
||||
Key: marshall({ pk: "website-template", id: "/" }),
|
||||
});
|
||||
|
||||
const resItem = (await dynamoDB.send(command)).Item;
|
||||
if (!resItem) throw Error();
|
||||
return {
|
||||
status: "success",
|
||||
message: "",
|
||||
data: unmarshall(resItem) as any,
|
||||
};
|
||||
} catch (error) {
|
||||
console.error(
|
||||
"DynamoDBWebsitePageTemplateRepository -> getIndexPageTemplate: ",
|
||||
error
|
||||
);
|
||||
return { status: "error", message: "Sayfa şablonu alınamadı." };
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
import { ApiResponse } from "@/lib/types/api_response";
|
||||
import { IndexPageTemplate } from "@/lib/types/website_page_templates/index_page_template";
|
||||
|
||||
export interface IWebsitePageTemplateRepository {
|
||||
getIndexPageTemplate: () => Promise<ApiResponse<IndexPageTemplate>>;
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
export interface IndexPageTemplate {
|
||||
pageTitle: string;
|
||||
logoUrl: string;
|
||||
headerNavigationItems: { title: string; link: string }[];
|
||||
welcomeHeadline: string;
|
||||
welcomeText: string;
|
||||
welcomeImageUrl: string;
|
||||
}
|
||||
@ -3,19 +3,27 @@ import { LandingPageView } from "../features/landing_page_view";
|
||||
import { DynamoDBThemeRepository } from "@/lib/repositories/theme/dynamodb_theme_repository";
|
||||
import { ThemeMetaDTO } from "@/lib/theme/theme_meta_dto";
|
||||
import ThemeApiService from "@/lib/services/theme/theme_api_service";
|
||||
import { DynamoDBWebsitePageTemplateRepository } from "@/lib/repositories/website_page_template/dynamodb_website_page_template_repository";
|
||||
import { IndexPageTemplate } from "@/lib/types/website_page_templates/index_page_template";
|
||||
|
||||
export default function LandingPage({
|
||||
themeMetas,
|
||||
pageTemplate,
|
||||
}: {
|
||||
themeMetas: ThemeMetaDTO[];
|
||||
pageTemplate: IndexPageTemplate;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Lazuri Doviguram</title>
|
||||
<title>{pageTemplate.pageTitle}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
</Head>
|
||||
<LandingPageView home="/" themePreviews={themeMetas} />
|
||||
<LandingPageView
|
||||
home="/"
|
||||
themePreviews={themeMetas}
|
||||
pageTemplate={pageTemplate}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@ -25,10 +33,21 @@ export async function getStaticProps() {
|
||||
const adminThemeRepoService = new ThemeApiService(themeRepo);
|
||||
const res = await adminThemeRepoService.getThemeMetas();
|
||||
|
||||
if (res.status === "success" && res.data) {
|
||||
const dynamodbWebsiteTemplateRepo =
|
||||
new DynamoDBWebsitePageTemplateRepository();
|
||||
const websiteTemplate =
|
||||
await dynamodbWebsiteTemplateRepo.getIndexPageTemplate();
|
||||
|
||||
if (
|
||||
res.status === "success" &&
|
||||
res.data &&
|
||||
websiteTemplate.status === "success" &&
|
||||
websiteTemplate.data
|
||||
) {
|
||||
return {
|
||||
props: {
|
||||
themeMetas: res.data,
|
||||
pageTemplate: websiteTemplate.data,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user