Skip to content

Commit

Permalink
Delete on autoredeploy
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasKnudsen committed Apr 10, 2024
2 parents 1e6b5e8 + a329df7 commit dcb7fb4
Show file tree
Hide file tree
Showing 37 changed files with 563 additions and 289 deletions.
6 changes: 1 addition & 5 deletions backend/src/api/article/content-types/article/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,15 @@
},
"pluginOptions": {},
"attributes": {
"title": {
"previewCardTitle": {
"type": "string",
"required": true,
"unique": true
},
"slug": {
"type": "uid",
"targetField": "title",
"required": true
},
"subtitle": {
"type": "string"
},
"datePublished": {
"type": "date",
"required": true
Expand Down
5 changes: 2 additions & 3 deletions backend/types/generated/contentTypes.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,9 +800,8 @@ export interface ApiArticleArticle extends Schema.CollectionType {
draftAndPublish: true;
};
attributes: {
title: Attribute.String & Attribute.Required & Attribute.Unique;
slug: Attribute.UID<'api::article.article', 'title'> & Attribute.Required;
subtitle: Attribute.String;
previewCardTitle: Attribute.String & Attribute.Required & Attribute.Unique;
slug: Attribute.UID & Attribute.Required;
datePublished: Attribute.Date & Attribute.Required;
coverImage: Attribute.Media;
body: Attribute.Blocks & Attribute.Required;
Expand Down
4 changes: 1 addition & 3 deletions frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
# Database url for outside requests
OUTSIDE_STRAPI_URL=http://localhost:1337

INTERNAL_STRAPI_URL=http://localhost:1337
STRAPI_URL=http://localhost:1337
4 changes: 1 addition & 3 deletions frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Database url for outside requests, set in github repo variables
OUTSIDE_STRAPI_URL=http://web.hypso.ies.ntnu.no:1337
STRAPI_URL=http://web.hypso.ies.ntnu.no:1337

# Database url for internal requests between the docker containers, set in github repo variables
INTERNAL_STRAPI_URL=http://backend:1337
4 changes: 4 additions & 0 deletions frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const nextConfig = {
hostname: "web.hypso.ies.ntnu.no",
port: '1337'
},
{
protocol: "http",
hostname: "backend",
},
],
},
};
Expand Down
43 changes: 43 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"cmdk": "0.2.0",
"country-emoji": "^1.5.6",
"framer-motion": "^11.0.24",
"globe.gl": "^2.32.2",
"gsap": "^3.12.5",
"lucide-react": "^0.314.0",
"luxon": "^3.4.4",
"next": "14.1.0",
"next-share": "^0.27.0",
"next-themes": "^0.2.1",
"node-geometry-library": "^1.2.6",
"ol": "^8.2.0",
Expand Down
13 changes: 4 additions & 9 deletions frontend/src/__generated__/gql.ts

Large diffs are not rendered by default.

25 changes: 7 additions & 18 deletions frontend/src/__generated__/graphql.ts

Large diffs are not rendered by default.

39 changes: 19 additions & 20 deletions frontend/src/app/blog/[articleSlug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
export const runtime = "edge";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { Avatar, AvatarFallback } from "@/components/ui/avatar";

import { BlocksContent } from "@strapi/blocks-react-renderer";
import BlockRendererClient from "@/components/BlockRendererClient";
import { gql } from "@/__generated__/gql";
import { getClient } from "@/lib/ApolloClient";
const OUTSIDE_STRAPI_URL = process.env.OUTSIDE_STRAPI_URL;
import { AvatarImageFix } from "@/components/AvatarImageFix";
import ShareButtons from "@/components/ShareButtons";

const STRAPI_URL = process.env.STRAPI_URL;

const GET_ARTICLE_BY_SLUG = gql(
`query ArticleWithSlug($articlesFilters: ArticleFiltersInput) {
articles(filters: $articlesFilters) {
data {
id
attributes {
author {
data {
Expand All @@ -35,8 +38,7 @@ const GET_ARTICLE_BY_SLUG = gql(
}
}
datePublished
subtitle
title
previewCardTitle
}
}
}
Expand Down Expand Up @@ -71,8 +73,8 @@ export default async function Page({
graphqlData.data.articles?.data[0]?.attributes?.author?.data?.attributes
?.avatar?.data?.attributes?.url;

if (OUTSIDE_STRAPI_URL && avatarURL != undefined) {
avatarURL = OUTSIDE_STRAPI_URL + avatarURL;
if (STRAPI_URL && avatarURL != undefined) {
avatarURL = STRAPI_URL + avatarURL;
}

const article = graphqlData.data.articles?.data[0];
Expand All @@ -82,15 +84,15 @@ export default async function Page({
const content: BlocksContent = article?.attributes?.body ?? [];

return (
<>
<div className="flex flex-col items-center gap-4">
<h1 className="text-4xl font-extrabold">
{article?.attributes?.title}
</h1>
<div className="flex flex-row items-center justify-center gap-1">
<div className="flex flex-col items-center gap-4">
<div className="w-1/2">
<BlockRendererClient content={content} />
</div>
<div className="flex w-1/2 flex-row items-center gap-1">
<div className="flex flex-1 justify-start gap-1">
{avatarURL && (
<Avatar className="">
<AvatarImage src={avatarURL} />
<AvatarImageFix src={avatarURL} />
<AvatarFallback>
{// Get initials from author name
authorName
Expand All @@ -105,13 +107,10 @@ export default async function Page({
<p>{datePublished}</p>
</div>
</div>
<p className="text-sm text-muted-foreground">
{article?.attributes?.subtitle}{" "}
</p>
<div className="w-1/2">
<BlockRendererClient content={content} />
<div className="flex flex-1 justify-end gap-1">
<ShareButtons slug={params.articleSlug} />
</div>
</div>
</>
</div>
);
}
60 changes: 30 additions & 30 deletions frontend/src/app/blog/blogDataCards.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const runtime = "edge";
import FullBlogCard from "@/components/fullBlogCard";
import BlogpageButtons from "@/components/BlogpageButtons";
import { BlogPost } from "./page";
import React from "react";

export default async function BlogDataCards({
articles,
Expand All @@ -17,34 +17,34 @@ export default async function BlogDataCards({
}

return (
<div className="flex w-3/4 flex-row flex-wrap items-center justify-center self-center">
{articles.map((article: any) => {
return (
<div
key={article.id}
className={
article.firstArticle
? "flex w-full flex-col items-center justify-center"
: "flex w-1/3 flex-col items-center justify-center"
}
>
<FullBlogCard
key={article.id}
firstArticle={article.firstArticle}
content={article.content}
coverImage={article.coverImage}
datePublished={article.datePublished}
tag={article.tag}
HOST_URL={article.HOST_URL}
authorName={article.authorName}
avatarURL={article.avatarURL}
slug={article.slug}
title={article.title}
/>{" "}
{article.firstArticle ? <BlogpageButtons /> : null}
</div>
);
})}
</div>
<>
<div className="grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3">
<BlogpageButtons className="col-span-full" />
{/* Only map fist article */}
{articles.map((article: BlogPost) => {
if (article.firstArticle) {
return (
<React.Fragment key={article.key}>
<FullBlogCard
className="col-span-full"
article={article}
/>
</React.Fragment>
);
}
})}

{articles.map((article: BlogPost) => {
if (article.firstArticle) {
return;
}
return (
<React.Fragment key={article.key}>
<FullBlogCard article={article} />
</React.Fragment>
);
})}
</div>
</>
);
}
5 changes: 5 additions & 0 deletions frontend/src/app/blog/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { PagePadding } from "@/components/PagePadding";
import React from "react";
export default function Layout({ children }: { children: React.ReactNode }) {
return <PagePadding>{children}</PagePadding>;
}
24 changes: 19 additions & 5 deletions frontend/src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import BlogDataCards from "./blogDataCards";
import { BlocksContent } from "@strapi/blocks-react-renderer";
import { Enum_Article_Tag } from "@/__generated__/graphql";
import fetchArticlePages from "@/lib/data/fetchArticleInfo";
import {
PageHeaderAndSubtitle,
PageSubtitle,
PageHeader,
} from "@/components/PageHeader";

export interface BlogPost {
key: string | null | undefined;
Expand Down Expand Up @@ -41,10 +46,19 @@ export default async function BlogPage({
const { articleList, totalArticles } = result;

return (
<div className="just flex flex-col content-center justify-center">
{/* <BlogDataCards articles={articleCache[currentPage]} /> */}
<BlogDataCards articles={articleList} />
<BlogPaginator totalArticles={totalArticles} />
</div>
<>
<PageHeaderAndSubtitle>
<PageHeader>Blog</PageHeader>
<PageSubtitle>
Welcome to the blog! Here you can find all of the articles
we have written.
</PageSubtitle>
</PageHeaderAndSubtitle>
<div className="flex flex-col justify-center">
{/* <BlogDataCards articles={articleCache[currentPage]} /> */}
<BlogDataCards articles={articleList} />
<BlogPaginator totalArticles={totalArticles} />
</div>
</>
);
}
7 changes: 3 additions & 4 deletions frontend/src/app/projects/[projectSlug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
export const runtime = "edge";
import { gql } from "@/__generated__/gql";
import BlockRendererClient from "@/components/BlockRendererClient";
import { getClient } from "@/lib/ApolloClient";
import { BlocksContent } from "@strapi/blocks-react-renderer";
import RelatedProjectsAndSatellites from "@/components/RelatedProjectsAndSatellites";
import { ProjectOrSatellite } from "@/app/satellites/[satelliteSlug]/page";
const OUTSIDE_STRAPI_URL = process.env.OUTSIDE_STRAPI_URL;
const STRAPI_URL = process.env.STRAPI_URL;

const GET_PROJECT_BY_SLUG = gql(`
query Projects($projectFilters: ProjectFiltersInput) {
Expand Down Expand Up @@ -70,8 +69,8 @@ export default async function Page({

let projectTitle = projects?.attributes?.slug;

if (OUTSIDE_STRAPI_URL && projectTitle != undefined) {
projectTitle = OUTSIDE_STRAPI_URL + projectTitle;
if (STRAPI_URL && projectTitle != undefined) {
projectTitle = STRAPI_URL + projectTitle;
}
return (
<div className="flex flex-col items-center gap-4">
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/app/projects/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { PagePadding } from "@/components/PagePadding";
import React from "react";
export default function Layout({ children }: { children: React.ReactNode }) {
return <PagePadding>{children}</PagePadding>;
}
Loading

0 comments on commit dcb7fb4

Please sign in to comment.