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

Feat/orcular academy content #100

Merged
merged 19 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
14 changes: 11 additions & 3 deletions src/components/AcademyIndexLoader.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ import { Course } from "@components";
import { transformAcademy } from "@util/ContentTransformer";
import type { AcademyPageFrontmatter } from "@interfaces/IAcademy";

const { language = "en" } = Astro.props;

// Only get files named index.mdx that are inside of a subfolder within the academy folder
const rawAcademyContent = await Astro.glob<AcademyPageFrontmatter>(
"../pages/en/academy/*/*.mdx"
);

let rawAcademyContent;
if (language === "ua") {
rawAcademyContent = await Astro.glob<AcademyPageFrontmatter>(
"../pages/ua/academy/*/*.mdx"
);
} else {
rawAcademyContent = await Astro.glob<AcademyPageFrontmatter>(
"../pages/en/academy/*/*.mdx"
);
}
const coursesAndLessons = transformAcademy(rawAcademyContent);
---

Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const Footer: React.FC<Props> = ({ className, menu, locale }: Props) => {
className={'-mt-12 sm:mt-0 h-full flex-shrink'}
href="https://www.giz.de"
target="_blank">
{locale === "ua" ? <GizLogoSvgUA className={'h-full'} /> : <GizLogoSvgEN className={'h-full w-full'} />}
{locale === "ua" ? <GizLogoSvgUA className={'h-full'} /> : <GizLogoSvgEN className={'h-full'} />}
</a>
<a
className={'-mt-60 sm:mt-0 h-full flex-shrink'}
Expand Down
38 changes: 38 additions & 0 deletions src/components/FooterCards.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
import { Card, CardContainer } from "@components";

interface Props {
language?: string;
}

const { language = "en" } = Astro.props;
---

<CardContainer className="lg:h-[408px]">
<Card
title={language === "ua"
? "Ти знаходишся в Україні і думаєш, що ми можемо бути тобі корисними?"
: "You are based in Ukraine and think we could help you?"}
bg={4}
target="mailto:[email protected]"
actionCaption={language === "ua" ? "Контактуй з нами" : "Get in contact"}
>
{
language === "ua"
? "Школи, університети, громадські організації, стартапи та інші організації можуть звернутись до нас з запитом на спільний з Толокаром проект, воркшоп або тренінг."
: "Schools, universities, NGOs, Startups and other organizations can reach out to us to request the Tolocars for projects, workshops and trainings."
}
</Card>
<Card
title={language === "ua"
? "Ти мейкер і хочеш налагодити партнерство з нами?"
: "You are a Maker and want to partner with us?"}
bg={5}
target="mailto:[email protected]"
actionCaption={language === "ua" ? "Контактуй з нами" : "Get in contact"}
>
Ми шукаємо мейкерів, фаблаби, хакерспейси, мейкерспейси та інші спільноти,
які мають бажання налагодити партнерство з нами в Україні або в інших
країнах.
</Card>
</CardContainer>
27 changes: 21 additions & 6 deletions src/components/Giscus.astro
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
---

interface Props {
language?: string;
}
const { language = "en" } = Astro.props;
---

<div class="w-full bg-neutral-50">
<div class="container-width md:grid grid-cols-12 gap-8 my-8">
<div class="col-start-5 col-span-7">
<div class="font-medium text-lg">Liked this resource? React or comment on GitHub</div>
<div class="w-full my-8 flex items-center after:content-[''] after:bg-neutral-300 after:h-[1px] after:flex-1 font-bold text-[15px] text-neutral-500"><span class="pr-4 bg-neutral-50 uppercase">Comments</span></div>
<div class="font-medium text-lg">
{
language === "ua"
? "Сподобався цей ресурс? Відреагуйте або прокоментуйте на Github"
: "Liked this resource? React or comment on GitHub"
}
</div>
<div
class="w-full my-8 flex items-center after:content-[''] after:bg-neutral-300 after:h-[1px] after:flex-1 font-bold text-[15px] text-neutral-500"
>
<span class="pr-4 bg-neutral-50 uppercase"
>{language === "ua" ? "Коментарі" : "Comments"}</span
>
</div>
<script
is:inline
src="https://giscus.app/client.js"
Expand All @@ -21,8 +37,7 @@
data-theme="light"
data-lang="en"
crossorigin="anonymous"
async
></script>
async></script>
</div>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions src/components/HeroImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ interface Props {
className?: string;
}

const HeroImage: React.FC<Props> = ({ className }: Props) => {
const HeroImage: React.FC<Props> = ({ className }) => {
return (
<div className="container-width mt-20 md:mt-32">
<div className="container-width mt-20 md:mt-32" id="top">
<div
className={`grayscale flex p-8 bg-center justify-center w-full h-full items-center bg-[url('/src/assets/Header.jpg')] ${
className || ""
Expand Down
4 changes: 3 additions & 1 deletion src/components/WideCardWrapper.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import CommonUtils from "@util/CommonUtils";
const { target, ...rest } = Astro.props;

const baseUrl = CommonUtils.getBaseUrl(true);

const prefixedTarget = target ? baseUrl + target : undefined;
---

<WideCardComponent {...rest} target={baseUrl + target} />
<WideCardComponent {...rest} target={prefixedTarget} />
37 changes: 13 additions & 24 deletions src/layouts/AcademyContent.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import {
AcademyHeroImage,
BackButton,
ContentSection,
Card,
CardContainer,
TableOfContents,
} from "@components";
import type { AcademyPageFrontmatter } from "@interfaces/IAcademy";
import { getParentPage } from "@util/ContentTransformer";
import fs from "node:fs";
import Giscus from "@components/Giscus.astro";
import CommonUtils from "@util/CommonUtils";
import FooterCards from "@components/FooterCards.astro";

const rawAcademyContent = await Astro.glob<AcademyPageFrontmatter>(
"../pages/en/academy/*/*.mdx"
Expand All @@ -25,13 +24,21 @@ const statsMtime = fs.statSync(file).mtime;
const editDate = new Date(statsMtime);

const parentPage = getParentPage(rawAcademyContent, url);

const localeFromUrl =
Astro?.url?.pathname.replace(baseUrl, "").split("/").filter(Boolean)[0] ||
"en";
---

<BaseLayout frontmatter={frontmatter}>
<div class="mt-20 container-width">
<BackButton target={`${baseUrl}en/academy`}
>Back to Academy Overview</BackButton
>
<BackButton target={`${baseUrl}${localeFromUrl}/academy`}>
{
localeFromUrl === "ua"
? "Повернутися до огляду Makerspace Academy"
: "Back to Academy Overview"
}
</BackButton>
</div>
<div class="container-width-hero">
<AcademyHeroImage
Expand Down Expand Up @@ -75,24 +82,6 @@ const parentPage = getParentPage(rawAcademyContent, url);
}`}
>
</div>
<CardContainer className="lg:h-[408px]">
<Card
title="You are based in Ukraine and think we could help you?"
bg={4}
target="mailto:[email protected]"
actionCaption="Get in contact"
>Schools, universities, NGOs, Startups and other organizations can reach
out to us to request the Tolocars for projects, workshops and trainings.</Card
>
<Card
title="You are a Maker and want to partner with us?"
bg={5}
target="mailto:[email protected]"
actionCaption="Get in contact"
>We are looking for Makers, FabLabs, Hackerspaces, Makerspaces and other
Communities who wants to partner with us in the Ukraine and
internationally over the internet.</Card
>
</CardContainer>
<FooterCards language={localeFromUrl} />
</ContentSection>
</BaseLayout>
30 changes: 10 additions & 20 deletions src/layouts/AcademyIndex.astro
Original file line number Diff line number Diff line change
@@ -1,31 +1,21 @@
---
import FooterCards from "@components/FooterCards.astro";
import BaseLayout from "./BaseLayout.astro";
import { ContentSection, Card, CardContainer } from "@components";
import { ContentSection } from "@components";
import CommonUtils from "@util/CommonUtils";
const { frontmatter } = Astro.props;

const baseUrl = CommonUtils.getBaseUrl(false);

const localeFromUrl =
Astro?.url?.pathname.replace(baseUrl, "").split("/").filter(Boolean)[0] ||
"en";
---

<BaseLayout footerGrey={true} frontmatter={frontmatter}>
<slot />
<ContentSection>
<div class="absolute w-full bg-white h-64 top-0"></div>
<CardContainer className="lg:h-[408px]">
<Card
title="You are based in Ukraine and think we could help you?"
bg={4}
target="mailto:[email protected]"
actionCaption="Get in contact"
>Schools, universities, NGOs, Startups and other organizations can reach
out to us to request the Tolocars for projects, workshops and trainings.</Card
>
<Card
title="You are a Maker and want to partner with us?"
bg={5}
target="mailto:[email protected]"
actionCaption="Get in contact"
>We are looking for Makers, FabLabs, Hackerspaces, Makerspaces and other
Communities who wants to partner with us in the Ukraine and
internationally over the internet.</Card
>
</CardContainer>
<FooterCards language={localeFromUrl} />
</ContentSection>
</BaseLayout>
2 changes: 1 addition & 1 deletion src/pages/en/_menu.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
menu:
- title: Home
target: "/en/#top"
target: "en/#top"
hideInFooter: true

- title: What is a Tolocar?
Expand Down
Loading
Loading