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/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/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/src/__generated__/gql.ts b/frontend/src/__generated__/gql.ts index 9bf5517..ebb194c 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 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 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 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. */ @@ -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..fffbd15 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, 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; }>; @@ -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":"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":"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..98db280 100644 --- a/frontend/src/app/projects/[projectSlug]/page.tsx +++ b/frontend/src/app/projects/[projectSlug]/page.tsx @@ -18,7 +18,8 @@ query Projects($projectFilters: ProjectFiltersInput) { id attributes { name - previewImage { + slug + satelliteImage { data { attributes { url @@ -84,14 +85,14 @@ 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, - slug: satellite.attributes.name, + previewImage: satelliteImage, + slug: satellite.attributes.slug, isProject: false, }; return ( 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} { }, ], }, - // Add other content blocks as needed ]; // Mount the BlockRendererClient with mock content @@ -32,11 +31,8 @@ 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", ); - - // Add more assertions based on your content blocks }); diff --git a/frontend/tests/componentTests/fullblogcard.spec.tsx b/frontend/tests/componentTests/fullblogcard.spec.tsx new file mode 100644 index 0000000..16b2ebf --- /dev/null +++ b/frontend/tests/componentTests/fullblogcard.spec.tsx @@ -0,0 +1,64 @@ +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(); + + //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(); + + //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); +}); 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/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...", + ); +}); 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 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(); + }); +});