From 00ce42c728c8204a1b1a46a49b3a8bde9ff339cd Mon Sep 17 00:00:00 2001 From: luctra02 <64017398+luctra02@users.noreply.github.com> Date: Sun, 21 Apr 2024 19:24:49 +0200 Subject: [PATCH 1/8] 279 test for viewing projects (#323) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test(frontend): :test_tube: Write test for project page Check if project page has title and subtitle. Add testids to elements in project page and individual project page. Check if individual project page has title and paragraph. * test(frontend): :test_tube: Added failing mobile project test * test(frontend): :white_check_mark: Fixed mobile project test and added hamburger to close navbar * fix(frontend): :lipstick: change tests for mobile to handle new navbar functionality * fix(frontend): :bug: run the tests on server instead of localhost * refactor(frontend): :recycle: run prettier * refactor(frontend): :recycle: run prettier --------- Co-authored-by: Jakob Grøtan Gregusson Co-authored-by: Jakobgg1243 Co-authored-by: Mats Nyfløt --- frontend/playwright.config.ts | 1 + frontend/tests/project.desktop.spec.ts | 33 ++++++++++++++++++++ frontend/tests/project.mobile.spec.ts | 42 ++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 frontend/tests/project.desktop.spec.ts create mode 100644 frontend/tests/project.mobile.spec.ts diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index 0e2e9f4..9b76a64 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -9,6 +9,7 @@ import { defineConfig, devices } from "@playwright/test"; /** * See https://playwright.dev/docs/test-configuration. */ +//const baseURL = `http://localhost:3000/`; const baseURL = `http://web.hypso.ies.ntnu.no:3000/`; export default defineConfig({ diff --git a/frontend/tests/project.desktop.spec.ts b/frontend/tests/project.desktop.spec.ts new file mode 100644 index 0000000..92af9f7 --- /dev/null +++ b/frontend/tests/project.desktop.spec.ts @@ -0,0 +1,33 @@ +import { test, expect } from "@playwright/test"; + +//BASE_URL: http://web.hypso.ies.ntnu.no:3000/ + +test.describe("All Project Page Test", () => { + test("CheckHeadingAndSubtitleIsVisible", async ({ page }) => { + await page.goto("/"); + await page.getByRole("button", { name: "Projects" }).click(); + await expect(page).toHaveURL("/projects"); + await expect(page.getByTestId("pageHeader")).toBeVisible(); + await expect(page.getByTestId("pageSubtitle")).toBeVisible(); + }); + test("CheckIfCardIsClickable", async ({ page }) => { + await page.goto("/"); + await page.getByRole("button", { name: "Projects" }).click(); + await expect(page).toHaveURL("/projects"); + await expect(page.getByTestId("projectCard").first()).toBeVisible(); + await page.getByTestId("projectCard").first().click(); + //Checks if the URL matches /projects/anySlug + await expect(page).toHaveURL(/\/projects\/.+$/); + }); +}); + +test.describe("Individual Project Page Test", () => { + test("TestHeadingAndParagraphIsVisible", async ({ page }) => { + await page.goto("/"); + await page.getByRole("button", { name: "Projects" }).click(); + await page.getByTestId("projectCard").first().click(); + await expect(page).toHaveURL(/\/projects\/.+$/); + await expect(page.getByRole("heading").first()).toBeVisible(); + await expect(page.getByTestId("blockParagraph").first()).toBeVisible(); + }); +}); diff --git a/frontend/tests/project.mobile.spec.ts b/frontend/tests/project.mobile.spec.ts new file mode 100644 index 0000000..6a766bf --- /dev/null +++ b/frontend/tests/project.mobile.spec.ts @@ -0,0 +1,42 @@ +import { test, expect } from "@playwright/test"; + +//BASE_URL: http://web.hypso.ies.ntnu.no:3000/ + +test.describe("All Project Page Test", () => { + test.use({ + viewport: { width: 390, height: 844 }, + }); + test("CheckHeadingAndSubtitleIsVisible", async ({ page }) => { + await page.goto("/"); + await page.getByRole("navigation").getByRole("button").click(); + await page.getByRole("button", { name: "Projects" }).click(); + await expect(page).toHaveURL("/projects"); + await expect(page.getByTestId("pageHeader")).toBeVisible(); + await expect(page.getByTestId("pageSubtitle")).toBeVisible(); + }); + test("CheckIfCardIsClickable", async ({ page }) => { + await page.goto("/"); + await page.getByRole("navigation").getByRole("button").click(); + await page.getByRole("button", { name: "Projects" }).click(); + await expect(page).toHaveURL("/projects"); + await expect(page.getByTestId("projectCard").first()).toBeVisible(); + await page.getByTestId("projectCard").first().click(); + //Checks if the URL matches /projects/anySlug + await expect(page).toHaveURL(/\/projects\/.+$/); + }); +}); + +test.describe("Individual Project Page Test", () => { + test.use({ + viewport: { width: 390, height: 844 }, + }); + test("TestHeadingAndParagraphIsVisible", async ({ page }) => { + await page.goto("/"); + await page.getByRole("navigation").getByRole("button").click(); + await page.getByRole("button", { name: "Projects" }).click(); + await page.getByTestId("projectCard").first().click(); + await expect(page).toHaveURL(/\/projects\/.+$/); + await expect(page.getByRole("heading").first()).toBeVisible(); + await expect(page.getByTestId("blockParagraph").first()).toBeVisible(); + }); +}); From 3681e855e0b34fe8f3ef5fdfab8ce0465951882f Mon Sep 17 00:00:00 2001 From: luctra02 <64017398+luctra02@users.noreply.github.com> Date: Sun, 21 Apr 2024 19:27:04 +0200 Subject: [PATCH 2/8] test(frontend): :test_tube: write component test for sharebuttons (#340) --- .../componentTests/sharebuttons.spec.tsx | 24 +++++++++++++++++++ frontend/tests/{ => e2e}/blog.desktop.spec.ts | 0 frontend/tests/{ => e2e}/blog.mobile.spec.ts | 0 3 files changed, 24 insertions(+) create mode 100644 frontend/tests/componentTests/sharebuttons.spec.tsx rename frontend/tests/{ => e2e}/blog.desktop.spec.ts (100%) rename frontend/tests/{ => e2e}/blog.mobile.spec.ts (100%) diff --git a/frontend/tests/componentTests/sharebuttons.spec.tsx b/frontend/tests/componentTests/sharebuttons.spec.tsx new file mode 100644 index 0000000..55825ce --- /dev/null +++ b/frontend/tests/componentTests/sharebuttons.spec.tsx @@ -0,0 +1,24 @@ +// Import necessary dependencies +import { test, expect } from "@playwright/experimental-ct-react"; +import ShareButtons from "@/components/ShareButtons"; + +// Define the test +test("Check ShareButtons component", async ({ mount }) => { + // Mock slug + const slug = "test-slug"; + + // Mount the ShareButtons component + const component = await mount(); + + // Check if Facebook icon is rendered + const facebookButton = component.getByLabel("facebook"); + await expect(facebookButton).toBeVisible(); + + // Check if Linkedin icon is rendered + const linkedinButton = component.getByLabel("linkedin"); + await expect(linkedinButton).toBeVisible(); + + // Check if Twitter icon is rendered + const twitterButton = component.getByLabel("twitter"); + await expect(twitterButton).toBeVisible(); +}); diff --git a/frontend/tests/blog.desktop.spec.ts b/frontend/tests/e2e/blog.desktop.spec.ts similarity index 100% rename from frontend/tests/blog.desktop.spec.ts rename to frontend/tests/e2e/blog.desktop.spec.ts diff --git a/frontend/tests/blog.mobile.spec.ts b/frontend/tests/e2e/blog.mobile.spec.ts similarity index 100% rename from frontend/tests/blog.mobile.spec.ts rename to frontend/tests/e2e/blog.mobile.spec.ts From bf1d1677fb5c9f4a45269aaf1549624bfb54fd36 Mon Sep 17 00:00:00 2001 From: luctra02 <64017398+luctra02@users.noreply.github.com> Date: Sun, 21 Apr 2024 19:28:18 +0200 Subject: [PATCH 3/8] 341 create component test for slicepreviewtext (#342) * test(frontend): :test_tube: write component test for sharebuttons * test(frontend): :test_tube: write test for slicepreviewtest to check if the component slices the 100 first chars in the first paragraph --- ...spec.tsx => blocksrendererclient.spec.tsx} | 3 -- .../componentTests/slicepreviewtext.spec.tsx | 53 +++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) rename frontend/tests/componentTests/{blocksrendererclient.desktop.spec.tsx => blocksrendererclient.spec.tsx} (91%) create mode 100644 frontend/tests/componentTests/slicepreviewtext.spec.tsx diff --git a/frontend/tests/componentTests/blocksrendererclient.desktop.spec.tsx b/frontend/tests/componentTests/blocksrendererclient.spec.tsx similarity index 91% rename from frontend/tests/componentTests/blocksrendererclient.desktop.spec.tsx rename to frontend/tests/componentTests/blocksrendererclient.spec.tsx index a307383..94f2bc3 100644 --- a/frontend/tests/componentTests/blocksrendererclient.desktop.spec.tsx +++ b/frontend/tests/componentTests/blocksrendererclient.spec.tsx @@ -24,7 +24,6 @@ test("Check content rendering in BlockRendererClient", async ({ mount }) => { }, ], }, - // Add other content blocks as needed ]; // Mount the BlockRendererClient with mock content @@ -37,6 +36,4 @@ test("Check content rendering in BlockRendererClient", async ({ mount }) => { await expect(component.getByRole("paragraph")).toContainText( "Dolor sit amet", ); - - // Add more assertions based on your content blocks }); diff --git a/frontend/tests/componentTests/slicepreviewtext.spec.tsx b/frontend/tests/componentTests/slicepreviewtext.spec.tsx new file mode 100644 index 0000000..b09ec88 --- /dev/null +++ b/frontend/tests/componentTests/slicepreviewtext.spec.tsx @@ -0,0 +1,53 @@ +import { test, expect } from "@playwright/experimental-ct-react"; +import { SlicePreviewText } from "@/components/SlicePreviewText"; +import { BlocksContent } from "@strapi/blocks-react-renderer"; + +test("Check SlicePreviewText function", async () => { + // Mock content with a paragraph block + const mockContent: BlocksContent = [ + { + type: "heading", + children: [ + { + type: "text", + text: "Lorem ipsum", + }, + ], + level: 1, + }, + { + type: "paragraph", + children: [ + { + type: "text", + text: "", + }, + ], + }, + { + type: "paragraph", + children: [ + { + type: "text", + text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pulvinar viverra diam. Aliquam venenatis fermentum nisl, ut pulvinar nunc consectetur ac. Nunc sit amet velit nibh. Sed sagittis mauris in elit varius aliquet. Phasellus lacus risus, suscipit sed nisl ac, consectetur faucibus est. Curabitur porta ante nec tortor finibus venenatis. Etiam ac nulla vitae est dapibus tincidunt. Quisque mollis pulvinar bibendum.", + }, + ], + }, + { + type: "paragraph", + children: [ + { + type: "text", + text: "Do not slice this paragraph, only the first one", + }, + ], + }, + ]; + + const slicedText = SlicePreviewText(mockContent); + + // Assert that the sliced text contains the expected content + expect(slicedText).toContain( + "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum pulvinar viverra diam. Aliquam v...", + ); +}); From 0c0612735bd8808859b9a832037f43e5aea64f4c Mon Sep 17 00:00:00 2001 From: Lukas Thrane <76877975+Windove@users.noreply.github.com> Date: Sun, 21 Apr 2024 19:36:50 +0200 Subject: [PATCH 4/8] 339 add satellite image to individual satellite page (#348) * rename satellite preview image to satelliteImage * fix image and satellites responsiveness --- .../content-types/satellite/schema.json | 2 +- backend/types/generated/contentTypes.d.ts | 2 +- frontend/src/__generated__/gql.ts | 12 ++++----- frontend/src/__generated__/graphql.ts | 16 +++++------ .../src/app/projects/[projectSlug]/page.tsx | 8 +++--- .../app/satellites/[satelliteSlug]/page.tsx | 22 +++++++++++++-- frontend/src/app/satellites/page.tsx | 27 +++++++++++++------ .../components/SatelliteResponsiveTable.tsx | 4 +-- .../satelliteData/SatelliteStatsTableRow.tsx | 16 ++++++----- frontend/src/components/ui/satelliteCard.tsx | 10 +++---- frontend/src/lib/data/fetchSatelliteInfo.ts | 10 +++++++ 11 files changed, 85 insertions(+), 44 deletions(-) diff --git a/backend/src/api/satellite/content-types/satellite/schema.json b/backend/src/api/satellite/content-types/satellite/schema.json index db5bd3c..166acba 100644 --- a/backend/src/api/satellite/content-types/satellite/schema.json +++ b/backend/src/api/satellite/content-types/satellite/schema.json @@ -24,7 +24,7 @@ "content": { "type": "blocks" }, - "previewImage": { + "satelliteImage": { "type": "media", "multiple": false, "required": false, diff --git a/backend/types/generated/contentTypes.d.ts b/backend/types/generated/contentTypes.d.ts index a063767..27038d4 100644 --- a/backend/types/generated/contentTypes.d.ts +++ b/backend/types/generated/contentTypes.d.ts @@ -980,7 +980,7 @@ export interface ApiSatelliteSatellite extends Schema.CollectionType { name: Attribute.String & Attribute.Required & Attribute.Unique; catalogNumberNORAD: Attribute.String & Attribute.Unique; content: Attribute.Blocks; - previewImage: Attribute.Media; + satelliteImage: Attribute.Media; projects: Attribute.Relation< 'api::satellite.satellite', 'manyToMany', diff --git a/frontend/src/__generated__/gql.ts b/frontend/src/__generated__/gql.ts index 9bf5517..0a05f20 100644 --- a/frontend/src/__generated__/gql.ts +++ b/frontend/src/__generated__/gql.ts @@ -14,13 +14,13 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ */ const documents = { "query ArticleWithSlug($articlesFilters: ArticleFiltersInput) {\n articles(filters: $articlesFilters) {\n data {\n id\n attributes {\n author {\n data {\n attributes {\n name\n avatar {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n body\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n datePublished\n previewTitle\n }\n }\n }\n }\n \n ": types.ArticleWithSlugDocument, - "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}": types.ProjectsDocument, + "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}": types.ProjectsDocument, "\n query GET_PROJECTS {\n projects(sort: [\"publishedAt:desc\"]) {\n data {\n id\n attributes {\n title\n content\n satellites {\n data {\n attributes {\n catalogNumberNORAD\n }\n }\n }\n slug\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n }": types.Get_ProjectsDocument, - "\nquery GET_SATELLITES {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n missionStatus\n slug\n massKg\n }\n }\n }\n }\n": types.Get_SatellitesDocument, + "\nquery GET_SATELLITES {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n missionStatus\n slug\n massKg\n }\n }\n }\n }\n": types.Get_SatellitesDocument, "\nquery Query($publicationState: PublicationState) {\n hero(publicationState: $publicationState) {\n data {\n attributes {\n title\n text\n image {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n }": types.QueryDocument, "\nquery GET_ARTICLES($pagination: PaginationArg, $filters: ArticleFiltersInput) {\n articles(sort: [\"datePublished:desc\"], pagination: $pagination, filters: $filters) {\n data {\n id\n attributes {\n author {\n data {\n attributes {\n name\n avatar {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n previewTitle\n datePublished\n body\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n createdAt\n publishedAt\n slug\n Tag\n }\n }\n meta {\n pagination {\n total\n }\n }\n }\n}\n": types.Get_ArticlesDocument, "\nquery FeaturedImage {\n featuredImage {\n data {\n attributes {\n featuredImage {\n data {\n attributes {\n url\n }\n }\n }\n satellite {\n data {\n attributes {\n catalogNumberNORAD\n name\n }\n }\n }\n createdAt\n updatedAt\n publishedAt\n }\n }\n }\n}\n\n": types.FeaturedImageDocument, - "query GET_SATELLITE_INFO($filters: SatelliteFiltersInput) {\n satellites(filters: $filters) {\n data {\n id\n attributes {\n catalogNumberNORAD\n content\n name\n massKg\n missionStatus\n projects {\n data {\n attributes {\n title\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n slug\n }\n id\n }\n }\n launchDate\n }\n }\n }\n }\n ": types.Get_Satellite_InfoDocument, + "query GET_SATELLITE_INFO($filters: SatelliteFiltersInput) {\n satellites(filters: $filters) {\n data {\n id\n attributes {\n catalogNumberNORAD\n content\n name\n massKg\n missionStatus\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n projects {\n data {\n attributes {\n title\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n slug\n }\n id\n }\n }\n launchDate\n }\n }\n }\n }\n ": types.Get_Satellite_InfoDocument, "\n query GET_SATELLITE_NAMES_AND_ID {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n }\n }\n }\n }\n": types.Get_Satellite_Names_And_IdDocument, }; @@ -45,7 +45,7 @@ export function gql(source: "query ArticleWithSlug($articlesFilters: ArticleFilt /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"): (typeof documents)["\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"]; +export function gql(source: "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"): (typeof documents)["\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -53,7 +53,7 @@ export function gql(source: "\n query GET_PROJECTS {\n projects(sort: [\"publ /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\nquery GET_SATELLITES {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n missionStatus\n slug\n massKg\n }\n }\n }\n }\n"): (typeof documents)["\nquery GET_SATELLITES {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n missionStatus\n slug\n massKg\n }\n }\n }\n }\n"]; +export function gql(source: "\nquery GET_SATELLITES {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n missionStatus\n slug\n massKg\n }\n }\n }\n }\n"): (typeof documents)["\nquery GET_SATELLITES {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n missionStatus\n slug\n massKg\n }\n }\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -69,7 +69,7 @@ export function gql(source: "\nquery FeaturedImage {\n featuredImage {\n /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "query GET_SATELLITE_INFO($filters: SatelliteFiltersInput) {\n satellites(filters: $filters) {\n data {\n id\n attributes {\n catalogNumberNORAD\n content\n name\n massKg\n missionStatus\n projects {\n data {\n attributes {\n title\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n slug\n }\n id\n }\n }\n launchDate\n }\n }\n }\n }\n "): (typeof documents)["query GET_SATELLITE_INFO($filters: SatelliteFiltersInput) {\n satellites(filters: $filters) {\n data {\n id\n attributes {\n catalogNumberNORAD\n content\n name\n massKg\n missionStatus\n projects {\n data {\n attributes {\n title\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n slug\n }\n id\n }\n }\n launchDate\n }\n }\n }\n }\n "]; +export function gql(source: "query GET_SATELLITE_INFO($filters: SatelliteFiltersInput) {\n satellites(filters: $filters) {\n data {\n id\n attributes {\n catalogNumberNORAD\n content\n name\n massKg\n missionStatus\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n projects {\n data {\n attributes {\n title\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n slug\n }\n id\n }\n }\n launchDate\n }\n }\n }\n }\n "): (typeof documents)["query GET_SATELLITE_INFO($filters: SatelliteFiltersInput) {\n satellites(filters: $filters) {\n data {\n id\n attributes {\n catalogNumberNORAD\n content\n name\n massKg\n missionStatus\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n projects {\n data {\n attributes {\n title\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n slug\n }\n id\n }\n }\n launchDate\n }\n }\n }\n }\n "]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/frontend/src/__generated__/graphql.ts b/frontend/src/__generated__/graphql.ts index 7505672..099761d 100644 --- a/frontend/src/__generated__/graphql.ts +++ b/frontend/src/__generated__/graphql.ts @@ -919,9 +919,9 @@ export type Satellite = { massKg?: Maybe; missionStatus?: Maybe; name: Scalars['String']['output']; - previewImage?: Maybe; projects?: Maybe; publishedAt?: Maybe; + satelliteImage?: Maybe; slug: Scalars['String']['output']; updatedAt?: Maybe; }; @@ -976,9 +976,9 @@ export type SatelliteInput = { massKg?: InputMaybe; missionStatus?: InputMaybe; name?: InputMaybe; - previewImage?: InputMaybe; projects?: InputMaybe>>; publishedAt?: InputMaybe; + satelliteImage?: InputMaybe; slug?: InputMaybe; }; @@ -1397,7 +1397,7 @@ export type ProjectsQueryVariables = Exact<{ }>; -export type ProjectsQuery = { __typename?: 'Query', projects?: { __typename?: 'ProjectEntityResponseCollection', data: Array<{ __typename?: 'ProjectEntity', attributes?: { __typename?: 'Project', title: string, content?: any | null, slug: string, satellites?: { __typename?: 'SatelliteRelationResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', name: string, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', id?: string | null, attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null }; +export type ProjectsQuery = { __typename?: 'Query', projects?: { __typename?: 'ProjectEntityResponseCollection', data: Array<{ __typename?: 'ProjectEntity', attributes?: { __typename?: 'Project', title: string, content?: any | null, slug: string, satellites?: { __typename?: 'SatelliteRelationResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', name: string, satelliteImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', id?: string | null, attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null }; export type Get_ProjectsQueryVariables = Exact<{ [key: string]: never; }>; @@ -1407,7 +1407,7 @@ export type Get_ProjectsQuery = { __typename?: 'Query', projects?: { __typename? export type Get_SatellitesQueryVariables = Exact<{ [key: string]: never; }>; -export type Get_SatellitesQuery = { __typename?: 'Query', satellites?: { __typename?: 'SatelliteEntityResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', catalogNumberNORAD?: string | null, name: string, missionStatus?: string | null, slug: string, massKg?: number | null, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null }; +export type Get_SatellitesQuery = { __typename?: 'Query', satellites?: { __typename?: 'SatelliteEntityResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', catalogNumberNORAD?: string | null, name: string, missionStatus?: string | null, slug: string, massKg?: number | null, satelliteImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null }; export type QueryQueryVariables = Exact<{ publicationState?: InputMaybe; @@ -1434,7 +1434,7 @@ export type Get_Satellite_InfoQueryVariables = Exact<{ }>; -export type Get_Satellite_InfoQuery = { __typename?: 'Query', satellites?: { __typename?: 'SatelliteEntityResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', catalogNumberNORAD?: string | null, content?: any | null, name: string, massKg?: number | null, missionStatus?: string | null, launchDate?: any | null, projects?: { __typename?: 'ProjectRelationResponseCollection', data: Array<{ __typename?: 'ProjectEntity', id?: string | null, attributes?: { __typename?: 'Project', title: string, slug: string, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null } | null }> } | null }; +export type Get_Satellite_InfoQuery = { __typename?: 'Query', satellites?: { __typename?: 'SatelliteEntityResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', catalogNumberNORAD?: string | null, content?: any | null, name: string, massKg?: number | null, missionStatus?: string | null, launchDate?: any | null, satelliteImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null, projects?: { __typename?: 'ProjectRelationResponseCollection', data: Array<{ __typename?: 'ProjectEntity', id?: string | null, attributes?: { __typename?: 'Project', title: string, slug: string, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null } | null }> } | null }; export type Get_Satellite_Names_And_IdQueryVariables = Exact<{ [key: string]: never; }>; @@ -1443,11 +1443,11 @@ export type Get_Satellite_Names_And_IdQuery = { __typename?: 'Query', satellites export const ArticleWithSlugDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ArticleWithSlug"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"articlesFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ArticleFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"articles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"articlesFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"author"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatar"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"body"}},{"kind":"Field","name":{"kind":"Name","value":"coverImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"datePublished"}},{"kind":"Field","name":{"kind":"Name","value":"previewTitle"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Projects"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProjectFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Projects"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProjectFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"satelliteImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_PROJECTS"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"publishedAt:desc","block":false}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const Get_SatellitesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_SATELLITES"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"missionStatus"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"massKg"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const Get_SatellitesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_SATELLITES"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"satelliteImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"missionStatus"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"massKg"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const QueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Query"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"publicationState"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PublicationState"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hero"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"publicationState"},"value":{"kind":"Variable","name":{"kind":"Name","value":"publicationState"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"image"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_ArticlesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_ARTICLES"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"pagination"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PaginationArg"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ArticleFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"articles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"datePublished:desc","block":false}]}},{"kind":"Argument","name":{"kind":"Name","value":"pagination"},"value":{"kind":"Variable","name":{"kind":"Name","value":"pagination"}}},{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"author"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatar"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"previewTitle"}},{"kind":"Field","name":{"kind":"Name","value":"datePublished"}},{"kind":"Field","name":{"kind":"Name","value":"body"}},{"kind":"Field","name":{"kind":"Name","value":"coverImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"publishedAt"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"Tag"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"meta"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"pagination"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"total"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const FeaturedImageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"FeaturedImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"featuredImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"featuredImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"satellite"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"publishedAt"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const Get_Satellite_InfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_SATELLITE_INFO"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"SatelliteFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"satellites"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"massKg"}},{"kind":"Field","name":{"kind":"Name","value":"missionStatus"}},{"kind":"Field","name":{"kind":"Name","value":"projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"launchDate"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const Get_Satellite_InfoDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_SATELLITE_INFO"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"filters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"SatelliteFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"satellites"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"filters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"massKg"}},{"kind":"Field","name":{"kind":"Name","value":"missionStatus"}},{"kind":"Field","name":{"kind":"Name","value":"satelliteImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"projects"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}}]}},{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"launchDate"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_Satellite_Names_And_IdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_SATELLITE_NAMES_AND_ID"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/frontend/src/app/projects/[projectSlug]/page.tsx b/frontend/src/app/projects/[projectSlug]/page.tsx index 3062aae..fb17d59 100644 --- a/frontend/src/app/projects/[projectSlug]/page.tsx +++ b/frontend/src/app/projects/[projectSlug]/page.tsx @@ -18,7 +18,7 @@ query Projects($projectFilters: ProjectFiltersInput) { id attributes { name - previewImage { + satelliteImage { data { attributes { url @@ -84,13 +84,13 @@ export default async function Page({
{graphqlData.data.projects?.data[0].attributes?.satellites?.data.map( (satellite: any) => { - const previewImage = - satellite?.attributes?.previewImage?.data + const satelliteImage = + satellite?.attributes?.satelliteImage?.data ?.attributes?.url ?? undefined; const satelliteObject: ProjectOrSatellite = { id: satellite.id, title: satellite.attributes.name, - previewImage: previewImage, + previewImage: satelliteImage, slug: satellite.attributes.name, isProject: false, }; diff --git a/frontend/src/app/satellites/[satelliteSlug]/page.tsx b/frontend/src/app/satellites/[satelliteSlug]/page.tsx index 50bc9db..a1597fc 100644 --- a/frontend/src/app/satellites/[satelliteSlug]/page.tsx +++ b/frontend/src/app/satellites/[satelliteSlug]/page.tsx @@ -11,6 +11,7 @@ import { PageSubtitle, PageHeaderAndSubtitle, } from "@/components/PageHeader"; +import Image from "next/image"; export interface SatelliteInfo { launchDate: string | undefined; @@ -20,6 +21,7 @@ export interface SatelliteInfo { noradId: string | undefined; missionStatus: string | undefined; massKg: number | undefined; + satelliteImage: string | undefined; } export interface ProjectOrSatellite { @@ -30,6 +32,8 @@ export interface ProjectOrSatellite { isProject: boolean; } +const STRAPI_URL = process.env.STRAPI_URL; + export default async function SatelliteInfoPage({ params, }: { @@ -41,6 +45,11 @@ export default async function SatelliteInfoPage({ if (!satelliteInfo) return
Loading...
; + let imageURL = undefined; + if (STRAPI_URL && satelliteInfo.satelliteImage) { + imageURL = STRAPI_URL + satelliteInfo.satelliteImage; + } + return ( <>
@@ -65,7 +74,7 @@ export default async function SatelliteInfoPage({
{/* Stats Container */}
-
+
{satelliteInfo.noradId ? "NORAD ID: " + satelliteInfo.noradId : null} @@ -84,7 +93,16 @@ export default async function SatelliteInfoPage({ {/* Image container */}
-

Satellite image

+ {imageURL ? ( + {satelliteInfo.name} + ) : null}
diff --git a/frontend/src/app/satellites/page.tsx b/frontend/src/app/satellites/page.tsx index 9b190f5..ed089e6 100644 --- a/frontend/src/app/satellites/page.tsx +++ b/frontend/src/app/satellites/page.tsx @@ -10,7 +10,7 @@ query GET_SATELLITES { attributes { catalogNumberNORAD name - previewImage { + satelliteImage { data { attributes { url @@ -32,21 +32,32 @@ export default async function Satellites() { query: GET_SATELLITES, }); + const noNoradIdArray = graphqlData.data.satellites?.data.filter( + (data) => data.attributes?.catalogNumberNORAD == null, + ); + return ( <> + {/* Table for satellites in orbit */} data.attributes?.catalogNumberNORAD !== null, )} inOrbit={true} > -
- data.attributes?.catalogNumberNORAD == null, - )} - inOrbit={false} - > + +
+ + {/* Table for satellites not in orbit */} + {noNoradIdArray != undefined && noNoradIdArray.length > 0 ? ( + + data.attributes?.catalogNumberNORAD == null, + )} + inOrbit={false} + > + ) : null} ); } catch (error) { diff --git a/frontend/src/components/SatelliteResponsiveTable.tsx b/frontend/src/components/SatelliteResponsiveTable.tsx index 5925910..2b598a9 100644 --- a/frontend/src/components/SatelliteResponsiveTable.tsx +++ b/frontend/src/components/SatelliteResponsiveTable.tsx @@ -54,10 +54,10 @@ export default function SatelliteResponsiveTable({ Altitude - + Latitude - + Longitude diff --git a/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx b/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx index 7be2aea..47e8ad0 100644 --- a/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx +++ b/frontend/src/components/satelliteData/SatelliteStatsTableRow.tsx @@ -42,8 +42,12 @@ export default function SatelliteStatsTableRow({ Loading... Loading... - Loading... - Loading... + + Loading... + + + Loading... + ); } @@ -60,13 +64,11 @@ export default function SatelliteStatsTableRow({ {satelliteInfo.velocity} km/s - - {satelliteInfo.altitude} km - - + {satelliteInfo.altitude} km + {satelliteInfo.latitudeDeg}° N - + {satelliteInfo.longitudeDeg}° E diff --git a/frontend/src/components/ui/satelliteCard.tsx b/frontend/src/components/ui/satelliteCard.tsx index 3ca9465..36d15bd 100644 --- a/frontend/src/components/ui/satelliteCard.tsx +++ b/frontend/src/components/ui/satelliteCard.tsx @@ -16,14 +16,14 @@ import { OuiImage } from "@/components/fullBlogCard"; interface SatelliteCardProps { satelliteName: string; missionStatus: string; - previewImage?: string; // Optional + satelliteImage?: string; // Optional satelliteId: Number; } const SatelliteCard: React.FC = ({ satelliteName, missionStatus, - previewImage, + satelliteImage, satelliteId, }) => { /*const setSelectedSatellite = useSatelliteStore( @@ -45,10 +45,10 @@ const SatelliteCard: React.FC = ({ satName={satelliteName} missionStatus={missionStatus} /> - {previewImage ? ( + {satelliteImage ? ( {previewImage} Date: Sun, 21 Apr 2024 21:40:43 +0200 Subject: [PATCH 5/8] 345 write component test for pageheader (#346) * test(frontend): :test_tube: write component test for sharebuttons * test(frontend): :test_tube: write test for slicepreviewtest to check if the component slices the 100 first chars in the first paragraph * test(frontend): :test_tube: write component test for fullBlogCard and check if the content is rendered correctly * test(frontend): :test_tube: Write component test for pageheader and check if the title and subtitle is rendered correctly --------- Co-authored-by: Mats <64415243+mnyflot@users.noreply.github.com> --- .../componentTests/fullblogcard.spec.tsx | 61 +++++++++++++++++++ .../tests/componentTests/pageheader.spec.tsx | 51 ++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 frontend/tests/componentTests/fullblogcard.spec.tsx create mode 100644 frontend/tests/componentTests/pageheader.spec.tsx diff --git a/frontend/tests/componentTests/fullblogcard.spec.tsx b/frontend/tests/componentTests/fullblogcard.spec.tsx new file mode 100644 index 0000000..001e7b7 --- /dev/null +++ b/frontend/tests/componentTests/fullblogcard.spec.tsx @@ -0,0 +1,61 @@ +import { test, expect } from "@playwright/experimental-ct-react"; +import FullBlogCard from "@/components/fullBlogCard"; +import { BlogPost } from "@/app/blog/page"; +import { Enum_Article_Tag } from "@/__generated__/graphql"; + +test("FullBlogCard renders correctly", async ({ mount }) => { + const mockArticle: BlogPost = { + key: "mock-key", + title: "Mock Article Title", + content: [ + { + type: "paragraph", + children: [ + { + type: "text", + text: "Mock article content preview text...", + }, + ], + }, + ], + coverImage: "mock-cover-image.jpg", + datePublished: "2024-04-13", + tag: Enum_Article_Tag.Projects, + slug: "mock-article-slug", + }; + // Mount the FullBlogCard component with mock data + const component = await mount(); + + //Check if the component is visible + await expect(component).toBeVisible(); + + //Check if title is correct + await expect(component.getByTestId("blogCardLink")).toContainText( + "Mock Article Title", + ); + + //Check if preview text for blog is visible + await expect( + component.getByText("Mock article content preview text..."), + ).toBeVisible(); + + //Check if the image is visible + await expect(component.getByRole("img")).toBeVisible(); + + //Check if datePublished is visible + await expect(component.getByText("April 13, 2024")).toBeVisible(); + + //Check if the tag is correct + await expect(component.getByTestId("articleTag")).toHaveText("Projects"); + + //Check if the urls on the links are correct + await expect(component.getByTestId("blogCardLink")).toHaveAttribute( + "href", + "/blog/mock-article-slug", + ); + + await expect(component.getByText("Read more")).toHaveAttribute( + "href", + "/blog/mock-article-slug", + ); +}); diff --git a/frontend/tests/componentTests/pageheader.spec.tsx b/frontend/tests/componentTests/pageheader.spec.tsx new file mode 100644 index 0000000..3c7445d --- /dev/null +++ b/frontend/tests/componentTests/pageheader.spec.tsx @@ -0,0 +1,51 @@ +import { test, expect } from "@playwright/experimental-ct-react"; +import { + PageHeader, + PageHeaderAndSubtitle, + PageSubtitle, +} from "@/components/PageHeader"; + +// Mock data +const headerText = "Welcome to our Page"; +const subtitleText = "Explore our content"; + +test("PageHeader renders correctly", async ({ mount }) => { + // Mount the PageHeader component with mock data + const component = await mount({headerText}); + + // Check if the component is visible + await expect(component).toBeVisible(); + + // Check if the header text is correct + await expect(component).toContainText(headerText); +}); + +test("PageSubtitle renders correctly", async ({ mount }) => { + // Mount the PageSubtitle component with mock data + const component = await mount({subtitleText}); + + // Check if the component is visible + await expect(component).toBeVisible(); + + // Check if the subtitle text is correct + await expect(component).toContainText(subtitleText); +}); + +test("PageHeaderAndSubtitle renders correctly", async ({ mount }) => { + // Mount the PageHeaderAndSubtitle component with mock data + const component = await mount( + + {headerText} + {subtitleText} + , + ); + + // Check if the component is visible + await expect(component).toBeVisible(); + + // Check if the header text is correct + await expect(component).toContainText(headerText); + + // Check if the subtitle text is correct + await expect(component).toContainText(subtitleText); +}); From 5dd949dd8499b2500500deb4917469eb6a6994c3 Mon Sep 17 00:00:00 2001 From: luctra02 <64017398+luctra02@users.noreply.github.com> Date: Sun, 21 Apr 2024 21:41:05 +0200 Subject: [PATCH 6/8] 343 write component test for fullblogcard (#344) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test(frontend): :test_tube: write component test for sharebuttons * test(frontend): :test_tube: write test for slicepreviewtest to check if the component slices the 100 first chars in the first paragraph * test(frontend): :test_tube: write component test for fullBlogCard and check if the content is rendered correctly --------- Co-authored-by: Mats Nyfløt --- frontend/tests/componentTests/blocksrendererclient.spec.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/tests/componentTests/blocksrendererclient.spec.tsx b/frontend/tests/componentTests/blocksrendererclient.spec.tsx index 94f2bc3..8e3f36d 100644 --- a/frontend/tests/componentTests/blocksrendererclient.spec.tsx +++ b/frontend/tests/componentTests/blocksrendererclient.spec.tsx @@ -31,7 +31,6 @@ test("Check content rendering in BlockRendererClient", async ({ mount }) => { , ); - // Assertions await expect(component.getByRole("heading")).toContainText("Lorem ipsum"); await expect(component.getByRole("paragraph")).toContainText( "Dolor sit amet", From 1082d33209e35f095c45aecf9a87d3a39b3f6fb8 Mon Sep 17 00:00:00 2001 From: Mats <64415243+mnyflot@users.noreply.github.com> Date: Mon, 22 Apr 2024 03:45:22 +0200 Subject: [PATCH 7/8] =?UTF-8?q?fix(frontend):=20:white=5Fcheck=5Fmark:=20u?= =?UTF-8?q?pdate=20fullBlogCard=20to=20test=20img=20src=E2=80=A6=20(#352)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): :white_check_mark: update fullBlogCard to test img src instead of visibility * fix(frontend): :bug: fix import bug, retries for component testing and run prettier --------- Co-authored-by: Lucas Tran --- frontend/playwright-ct.config.ts | 2 +- frontend/src/lib/convertSatrec.ts | 2 +- frontend/tests/componentTests/fullblogcard.spec.tsx | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/playwright-ct.config.ts b/frontend/playwright-ct.config.ts index bfa5c8f..5345b7e 100644 --- a/frontend/playwright-ct.config.ts +++ b/frontend/playwright-ct.config.ts @@ -18,7 +18,7 @@ export default defineConfig({ /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, + retries: 2, /* Opt out of parallel tests on CI. */ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ diff --git a/frontend/src/lib/convertSatrec.ts b/frontend/src/lib/convertSatrec.ts index d27a51f..211f22a 100644 --- a/frontend/src/lib/convertSatrec.ts +++ b/frontend/src/lib/convertSatrec.ts @@ -1,6 +1,6 @@ import * as satellite from "satellite.js"; import { SatRec } from "satellite.js"; -import globeData from "@components/homeComponents/files/globe-data.json"; +import globeData from "@/components/homeComponents/files/globe-data.json"; // turf needs ts ignore to work with typescript // @ts-ignore diff --git a/frontend/tests/componentTests/fullblogcard.spec.tsx b/frontend/tests/componentTests/fullblogcard.spec.tsx index 001e7b7..16b2ebf 100644 --- a/frontend/tests/componentTests/fullblogcard.spec.tsx +++ b/frontend/tests/componentTests/fullblogcard.spec.tsx @@ -39,8 +39,11 @@ test("FullBlogCard renders correctly", async ({ mount }) => { component.getByText("Mock article content preview text..."), ).toBeVisible(); - //Check if the image is visible - await expect(component.getByRole("img")).toBeVisible(); + //Wait for the image to actually have its src attribute set with the real image URL + await expect(component.getByRole("img")).toHaveAttribute( + "src", + /mock-cover-image\.jpg/, + ); //Check if datePublished is visible await expect(component.getByText("April 13, 2024")).toBeVisible(); From ea3bdeeb528dea19e8d97eab92c3303c2ecf27f0 Mon Sep 17 00:00:00 2001 From: Mats <64415243+mnyflot@users.noreply.github.com> Date: Mon, 22 Apr 2024 11:06:05 +0200 Subject: [PATCH 8/8] fix(backend): :bug: fix related satellites so it links with slug and not name (#349) lgtm --- frontend/src/__generated__/gql.ts | 4 ++-- frontend/src/__generated__/graphql.ts | 4 ++-- frontend/src/app/projects/[projectSlug]/page.tsx | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/frontend/src/__generated__/gql.ts b/frontend/src/__generated__/gql.ts index 0a05f20..ebb194c 100644 --- a/frontend/src/__generated__/gql.ts +++ b/frontend/src/__generated__/gql.ts @@ -14,7 +14,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ */ const documents = { "query ArticleWithSlug($articlesFilters: ArticleFiltersInput) {\n articles(filters: $articlesFilters) {\n data {\n id\n attributes {\n author {\n data {\n attributes {\n name\n avatar {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n body\n coverImage {\n data {\n attributes {\n url\n }\n }\n }\n datePublished\n previewTitle\n }\n }\n }\n }\n \n ": types.ArticleWithSlugDocument, - "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}": types.ProjectsDocument, + "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n slug\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}": types.ProjectsDocument, "\n query GET_PROJECTS {\n projects(sort: [\"publishedAt:desc\"]) {\n data {\n id\n attributes {\n title\n content\n satellites {\n data {\n attributes {\n catalogNumberNORAD\n }\n }\n }\n slug\n previewImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n }": types.Get_ProjectsDocument, "\nquery GET_SATELLITES {\n satellites {\n data {\n id\n attributes {\n catalogNumberNORAD\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n missionStatus\n slug\n massKg\n }\n }\n }\n }\n": types.Get_SatellitesDocument, "\nquery Query($publicationState: PublicationState) {\n hero(publicationState: $publicationState) {\n data {\n attributes {\n title\n text\n image {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n }": types.QueryDocument, @@ -45,7 +45,7 @@ export function gql(source: "query ArticleWithSlug($articlesFilters: ArticleFilt /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"): (typeof documents)["\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"]; +export function gql(source: "\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n slug\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"): (typeof documents)["\nquery Projects($projectFilters: ProjectFiltersInput) {\n projects(filters: $projectFilters) {\n data {\n attributes {\n title\n content\n satellites {\n data {\n id\n attributes {\n name\n slug\n satelliteImage {\n data {\n attributes {\n url\n }\n }\n }\n }\n }\n }\n slug\n previewImage {\n data {\n id\n attributes {\n url\n }\n }\n }\n }\n }\n }\n}"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/frontend/src/__generated__/graphql.ts b/frontend/src/__generated__/graphql.ts index 099761d..fffbd15 100644 --- a/frontend/src/__generated__/graphql.ts +++ b/frontend/src/__generated__/graphql.ts @@ -1397,7 +1397,7 @@ export type ProjectsQueryVariables = Exact<{ }>; -export type ProjectsQuery = { __typename?: 'Query', projects?: { __typename?: 'ProjectEntityResponseCollection', data: Array<{ __typename?: 'ProjectEntity', attributes?: { __typename?: 'Project', title: string, content?: any | null, slug: string, satellites?: { __typename?: 'SatelliteRelationResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', name: string, satelliteImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', id?: string | null, attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null }; +export type ProjectsQuery = { __typename?: 'Query', projects?: { __typename?: 'ProjectEntityResponseCollection', data: Array<{ __typename?: 'ProjectEntity', attributes?: { __typename?: 'Project', title: string, content?: any | null, slug: string, satellites?: { __typename?: 'SatelliteRelationResponseCollection', data: Array<{ __typename?: 'SatelliteEntity', id?: string | null, attributes?: { __typename?: 'Satellite', name: string, slug: string, satelliteImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null, previewImage?: { __typename?: 'UploadFileEntityResponse', data?: { __typename?: 'UploadFileEntity', id?: string | null, attributes?: { __typename?: 'UploadFile', url: string } | null } | null } | null } | null }> } | null }; export type Get_ProjectsQueryVariables = Exact<{ [key: string]: never; }>; @@ -1443,7 +1443,7 @@ export type Get_Satellite_Names_And_IdQuery = { __typename?: 'Query', satellites export const ArticleWithSlugDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ArticleWithSlug"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"articlesFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ArticleFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"articles"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"articlesFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"author"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatar"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"body"}},{"kind":"Field","name":{"kind":"Name","value":"coverImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"datePublished"}},{"kind":"Field","name":{"kind":"Name","value":"previewTitle"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Projects"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProjectFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"satelliteImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Projects"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"ProjectFiltersInput"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"filters"},"value":{"kind":"Variable","name":{"kind":"Name","value":"projectFilters"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"satelliteImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_ProjectsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_PROJECTS"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"projects"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"sort"},"value":{"kind":"ListValue","values":[{"kind":"StringValue","value":"publishedAt:desc","block":false}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"previewImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const Get_SatellitesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GET_SATELLITES"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"satellites"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"catalogNumberNORAD"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"satelliteImage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"missionStatus"}},{"kind":"Field","name":{"kind":"Name","value":"slug"}},{"kind":"Field","name":{"kind":"Name","value":"massKg"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const QueryDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Query"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"publicationState"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"PublicationState"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"hero"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"publicationState"},"value":{"kind":"Variable","name":{"kind":"Name","value":"publicationState"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"text"}},{"kind":"Field","name":{"kind":"Name","value":"image"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"data"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attributes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"url"}}]}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; diff --git a/frontend/src/app/projects/[projectSlug]/page.tsx b/frontend/src/app/projects/[projectSlug]/page.tsx index fb17d59..98db280 100644 --- a/frontend/src/app/projects/[projectSlug]/page.tsx +++ b/frontend/src/app/projects/[projectSlug]/page.tsx @@ -18,6 +18,7 @@ query Projects($projectFilters: ProjectFiltersInput) { id attributes { name + slug satelliteImage { data { attributes { @@ -91,7 +92,7 @@ export default async function Page({ id: satellite.id, title: satellite.attributes.name, previewImage: satelliteImage, - slug: satellite.attributes.name, + slug: satellite.attributes.slug, isProject: false, }; return (