add contacts to icon hepler
This commit is contained in:
@@ -227,6 +227,22 @@ type ComponentSharedContact {
|
|||||||
value: String!
|
value: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input ComponentSharedContactFiltersInput {
|
||||||
|
and: [ComponentSharedContactFiltersInput]
|
||||||
|
displayValue: StringFilterInput
|
||||||
|
not: ComponentSharedContactFiltersInput
|
||||||
|
or: [ComponentSharedContactFiltersInput]
|
||||||
|
type: StringFilterInput
|
||||||
|
value: StringFilterInput
|
||||||
|
}
|
||||||
|
|
||||||
|
input ComponentSharedContactInput {
|
||||||
|
displayValue: String
|
||||||
|
id: ID
|
||||||
|
type: ENUM_COMPONENTSHAREDCONTACT_TYPE
|
||||||
|
value: String
|
||||||
|
}
|
||||||
|
|
||||||
type ComponentSharedIcon {
|
type ComponentSharedIcon {
|
||||||
id: ID!
|
id: ID!
|
||||||
value: ENUM_COMPONENTSHAREDICON_VALUE
|
value: ENUM_COMPONENTSHAREDICON_VALUE
|
||||||
@@ -678,6 +694,7 @@ type ReviewWorkflowsWorkflowStageRelationResponseCollection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SiteConfig {
|
type SiteConfig {
|
||||||
|
contacts(filters: ComponentSharedContactFiltersInput, pagination: PaginationArg = {}, sort: [String] = []): [ComponentSharedContact]
|
||||||
createdAt: DateTime
|
createdAt: DateTime
|
||||||
description: String
|
description: String
|
||||||
documentId: ID!
|
documentId: ID!
|
||||||
@@ -687,6 +704,7 @@ type SiteConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input SiteConfigInput {
|
input SiteConfigInput {
|
||||||
|
contacts: [ComponentSharedContactInput]
|
||||||
description: String
|
description: String
|
||||||
publishedAt: DateTime
|
publishedAt: DateTime
|
||||||
title: String
|
title: String
|
||||||
|
|||||||
13
src/graphql-documents/site-config.gql.generated.ts
Normal file
13
src/graphql-documents/site-config.gql.generated.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/* eslint-disable */
|
||||||
|
/* Generated by scripts/endpoint-generate.mjs — do not edit by hand */
|
||||||
|
import type { ExecutionResult } from "graphql";
|
||||||
|
|
||||||
|
import { execute } from "../graphql/execute";
|
||||||
|
import type { SiteConfigQueryQuery, SiteConfigQueryQueryVariables } from "../graphql/graphql";
|
||||||
|
import { siteConfigDocument } from "./site-config.gql";
|
||||||
|
|
||||||
|
export const siteConfigQueryQuery = {
|
||||||
|
async execute(variables?: SiteConfigQueryQueryVariables): Promise<ExecutionResult<SiteConfigQueryQuery>> {
|
||||||
|
return execute<SiteConfigQueryQuery, SiteConfigQueryQueryVariables>(siteConfigDocument, variables);
|
||||||
|
},
|
||||||
|
};
|
||||||
16
src/graphql-documents/site-config.gql.ts
Normal file
16
src/graphql-documents/site-config.gql.ts
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
|
export const siteConfigDocument = gql`
|
||||||
|
query SiteConfigQuery {
|
||||||
|
siteConfig {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
contacts {
|
||||||
|
id
|
||||||
|
type
|
||||||
|
value
|
||||||
|
displayValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
@@ -321,6 +321,22 @@ export type ComponentSharedContact = {
|
|||||||
value: Scalars['String']['output'];
|
value: Scalars['String']['output'];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ComponentSharedContactFiltersInput = {
|
||||||
|
and?: InputMaybe<Array<InputMaybe<ComponentSharedContactFiltersInput>>>;
|
||||||
|
displayValue?: InputMaybe<StringFilterInput>;
|
||||||
|
not?: InputMaybe<ComponentSharedContactFiltersInput>;
|
||||||
|
or?: InputMaybe<Array<InputMaybe<ComponentSharedContactFiltersInput>>>;
|
||||||
|
type?: InputMaybe<StringFilterInput>;
|
||||||
|
value?: InputMaybe<StringFilterInput>;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ComponentSharedContactInput = {
|
||||||
|
displayValue?: InputMaybe<Scalars['String']['input']>;
|
||||||
|
id?: InputMaybe<Scalars['ID']['input']>;
|
||||||
|
type?: InputMaybe<Enum_Componentsharedcontact_Type>;
|
||||||
|
value?: InputMaybe<Scalars['String']['input']>;
|
||||||
|
};
|
||||||
|
|
||||||
export type ComponentSharedIcon = {
|
export type ComponentSharedIcon = {
|
||||||
__typename?: 'ComponentSharedIcon';
|
__typename?: 'ComponentSharedIcon';
|
||||||
id: Scalars['ID']['output'];
|
id: Scalars['ID']['output'];
|
||||||
@@ -1151,6 +1167,7 @@ export type ReviewWorkflowsWorkflowStageRelationResponseCollection = {
|
|||||||
|
|
||||||
export type SiteConfig = {
|
export type SiteConfig = {
|
||||||
__typename?: 'SiteConfig';
|
__typename?: 'SiteConfig';
|
||||||
|
contacts?: Maybe<Array<Maybe<ComponentSharedContact>>>;
|
||||||
createdAt?: Maybe<Scalars['DateTime']['output']>;
|
createdAt?: Maybe<Scalars['DateTime']['output']>;
|
||||||
description?: Maybe<Scalars['String']['output']>;
|
description?: Maybe<Scalars['String']['output']>;
|
||||||
documentId: Scalars['ID']['output'];
|
documentId: Scalars['ID']['output'];
|
||||||
@@ -1159,7 +1176,15 @@ export type SiteConfig = {
|
|||||||
updatedAt?: Maybe<Scalars['DateTime']['output']>;
|
updatedAt?: Maybe<Scalars['DateTime']['output']>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export type SiteConfigContactsArgs = {
|
||||||
|
filters?: InputMaybe<ComponentSharedContactFiltersInput>;
|
||||||
|
pagination?: InputMaybe<PaginationArg>;
|
||||||
|
sort?: InputMaybe<Array<InputMaybe<Scalars['String']['input']>>>;
|
||||||
|
};
|
||||||
|
|
||||||
export type SiteConfigInput = {
|
export type SiteConfigInput = {
|
||||||
|
contacts?: InputMaybe<Array<InputMaybe<ComponentSharedContactInput>>>;
|
||||||
description?: InputMaybe<Scalars['String']['input']>;
|
description?: InputMaybe<Scalars['String']['input']>;
|
||||||
publishedAt?: InputMaybe<Scalars['DateTime']['input']>;
|
publishedAt?: InputMaybe<Scalars['DateTime']['input']>;
|
||||||
title?: InputMaybe<Scalars['String']['input']>;
|
title?: InputMaybe<Scalars['String']['input']>;
|
||||||
@@ -1538,14 +1563,19 @@ export type HomePageQueryQueryVariables = Exact<{ [key: string]: never; }>;
|
|||||||
|
|
||||||
|
|
||||||
export type HomePageQueryQuery = { __typename?: 'Query', homePage?: { __typename?: 'HomePage', sections?: Array<
|
export type HomePageQueryQuery = { __typename?: 'Query', homePage?: { __typename?: 'HomePage', sections?: Array<
|
||||||
| { __typename?: 'ComponentSectionsAbout', id: string, title?: string | null, description?: string | null, partners?: Array<{ __typename?: 'ComponentSharedString', id: string, value: string } | null> | null, cards?: Array<{ __typename?: 'ComponentCardsAdvantage', id: string, title?: string | null, description?: string | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null } | null> | null }
|
| { __typename: 'ComponentSectionsAbout', id: string, title?: string | null, description?: string | null, partners?: Array<{ __typename?: 'ComponentSharedString', id: string, value: string } | null> | null, cards?: Array<{ __typename?: 'ComponentCardsAdvantage', id: string, title?: string | null, description?: string | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null } | null> | null }
|
||||||
| { __typename?: 'ComponentSectionsCases', id: string, title?: string | null, description?: string | null, cards?: Array<{ __typename?: 'ComponentCardsCase', id: string, title?: string | null, description?: string | null, pretitle?: string | null, badge?: string | null, footnote?: string | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null } | null> | null }
|
| { __typename: 'ComponentSectionsCases', id: string, title?: string | null, description?: string | null, cards?: Array<{ __typename?: 'ComponentCardsCase', id: string, title?: string | null, description?: string | null, pretitle?: string | null, badge?: string | null, footnote?: string | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null } | null> | null }
|
||||||
| { __typename?: 'ComponentSectionsHomeHero', id: string, title?: string | null, description?: string | null, badge?: string | null, stats?: Array<{ __typename?: 'ComponentSharedAttribute', id: string, key?: string | null, value?: string | null } | null> | null }
|
| { __typename: 'ComponentSectionsHomeHero', id: string, title?: string | null, description?: string | null, badge?: string | null, stats?: Array<{ __typename?: 'ComponentSharedAttribute', id: string, key?: string | null, value?: string | null } | null> | null }
|
||||||
| { __typename?: 'ComponentSectionsServices', id: string, title?: string | null, description?: string | null, cards?: Array<{ __typename?: 'ComponentCardsService', id: string, title?: string | null, description?: string | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, category?: { __typename?: 'Category', slug: string } | null } | null> | null }
|
| { __typename: 'ComponentSectionsServices', id: string, title?: string | null, description?: string | null, cards?: Array<{ __typename?: 'ComponentCardsService', id: string, title?: string | null, description?: string | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null, color?: { __typename?: 'ComponentSharedColor', value?: Enum_Componentsharedcolor_Value | null } | null, category?: { __typename?: 'Category', slug: string } | null } | null> | null }
|
||||||
| { __typename?: 'ComponentSectionsSolutions', id: string, title?: string | null, description?: string | null, cards?: Array<{ __typename?: 'ComponentCardsSolution', id: string, title?: string | null, description?: string | null, footnote?: string | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null, category?: { __typename?: 'Category', slug: string } | null } | null> | null }
|
| { __typename: 'ComponentSectionsSolutions', id: string, title?: string | null, description?: string | null, cards?: Array<{ __typename?: 'ComponentCardsSolution', id: string, title?: string | null, description?: string | null, footnote?: string | null, icon?: { __typename?: 'ComponentSharedIcon', value?: Enum_Componentsharedicon_Value | null } | null, category?: { __typename?: 'Category', slug: string } | null } | null> | null }
|
||||||
| { __typename?: 'Error' }
|
| { __typename: 'Error' }
|
||||||
| null> | null } | null };
|
| null> | null } | null };
|
||||||
|
|
||||||
|
export type SiteConfigQueryQueryVariables = Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
|
export type SiteConfigQueryQuery = { __typename?: 'Query', siteConfig?: { __typename?: 'SiteConfig', title: string, description?: string | null, contacts?: Array<{ __typename?: 'ComponentSharedContact', id: string, type: Enum_Componentsharedcontact_Type, value: string, displayValue?: string | null } | null> | null } | null };
|
||||||
|
|
||||||
export class TypedDocumentString<TResult, TVariables>
|
export class TypedDocumentString<TResult, TVariables>
|
||||||
extends String
|
extends String
|
||||||
implements DocumentTypeDecoration<TResult, TVariables>
|
implements DocumentTypeDecoration<TResult, TVariables>
|
||||||
@@ -1581,6 +1611,7 @@ export const HomePageQueryDocument = new TypedDocumentString(`
|
|||||||
query HomePageQuery {
|
query HomePageQuery {
|
||||||
homePage {
|
homePage {
|
||||||
sections {
|
sections {
|
||||||
|
__typename
|
||||||
... on ComponentSectionsHomeHero {
|
... on ComponentSectionsHomeHero {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
@@ -1670,4 +1701,18 @@ export const HomePageQueryDocument = new TypedDocumentString(`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`) as unknown as TypedDocumentString<HomePageQueryQuery, HomePageQueryQueryVariables>;
|
`) as unknown as TypedDocumentString<HomePageQueryQuery, HomePageQueryQueryVariables>;
|
||||||
|
export const SiteConfigQueryDocument = new TypedDocumentString(`
|
||||||
|
query SiteConfigQuery {
|
||||||
|
siteConfig {
|
||||||
|
title
|
||||||
|
description
|
||||||
|
contacts {
|
||||||
|
id
|
||||||
|
type
|
||||||
|
value
|
||||||
|
displayValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`) as unknown as TypedDocumentString<SiteConfigQueryQuery, SiteConfigQueryQueryVariables>;
|
||||||
21
src/lib/cms/contact/toIcon.ts
Normal file
21
src/lib/cms/contact/toIcon.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import type { LucideIcon } from 'lucide-react'
|
||||||
|
import { Clock, Mail, MapPin, Phone } from 'lucide-react'
|
||||||
|
|
||||||
|
import { Enum_Componentsharedcontact_Type } from '../../../graphql/graphql'
|
||||||
|
import type { Maybe } from '../../types'
|
||||||
|
|
||||||
|
const DEFAULT_ICON = Mail
|
||||||
|
|
||||||
|
const CONTACT_ICON_MAP: Record<Enum_Componentsharedcontact_Type, LucideIcon> = {
|
||||||
|
[Enum_Componentsharedcontact_Type.Address]: MapPin,
|
||||||
|
[Enum_Componentsharedcontact_Type.Email]: Mail,
|
||||||
|
[Enum_Componentsharedcontact_Type.Phone]: Phone,
|
||||||
|
[Enum_Componentsharedcontact_Type.WorkingHours]: Clock,
|
||||||
|
}
|
||||||
|
|
||||||
|
export function toIcon(type?: Maybe<Enum_Componentsharedcontact_Type>): LucideIcon {
|
||||||
|
if (type != null && type in CONTACT_ICON_MAP) {
|
||||||
|
return CONTACT_ICON_MAP[type]
|
||||||
|
}
|
||||||
|
return DEFAULT_ICON
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user