diff --git a/apps/datahub/src/app/home/news-page/news-page.component.html b/apps/datahub/src/app/home/news-page/news-page.component.html index 6ef8e789a8..9913a7e43a 100644 --- a/apps/datahub/src/app/home/news-page/news-page.component.html +++ b/apps/datahub/src/app/home/news-page/news-page.component.html @@ -20,6 +20,28 @@ datahub.news.figures +
+

+ datahub.news.contact.title +

+
+ + datahub.news.contact.contactus + +
diff --git a/apps/datahub/src/app/home/news-page/news-page.component.spec.ts b/apps/datahub/src/app/home/news-page/news-page.component.spec.ts index f399a4d875..e60308e5be 100644 --- a/apps/datahub/src/app/home/news-page/news-page.component.spec.ts +++ b/apps/datahub/src/app/home/news-page/news-page.component.spec.ts @@ -1,7 +1,15 @@ import { ComponentFixture, TestBed } from '@angular/core/testing' import { NewsPageComponent } from './news-page.component' import { NO_ERRORS_SCHEMA } from '@angular/core' +import { getGlobalConfig } from '@geonetwork-ui/util/app-config' +import { TranslateTestingModule } from '@geonetwork-ui/util/i18n' +import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler' +jest.mock('@geonetwork-ui/util/app-config', () => ({ + getGlobalConfig: jest.fn(() => ({ + CONTACT_EMAIL: 'mocked-email@example.com', + })), +})) describe('NewsPageComponent', () => { let component: NewsPageComponent let fixture: ComponentFixture @@ -9,6 +17,15 @@ describe('NewsPageComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ declarations: [NewsPageComponent], + imports: [ + TranslateTestingModule.withTranslations({ + en: { + 'datahub.news.contact.html': '

line1

line2

', + }, + }) + .withDefaultLanguage('en') + .withCompiler(new TranslateMessageFormatCompiler()), + ], schemas: [NO_ERRORS_SCHEMA], }).compileComponents() @@ -20,4 +37,8 @@ describe('NewsPageComponent', () => { it('should create', () => { expect(component).toBeTruthy() }) + + it('should return email', () => { + expect(getGlobalConfig().CONTACT_EMAIL).toEqual('mocked-email@example.com') + }) }) diff --git a/apps/datahub/src/app/home/news-page/news-page.component.ts b/apps/datahub/src/app/home/news-page/news-page.component.ts index e41532bc6d..3730bcd214 100644 --- a/apps/datahub/src/app/home/news-page/news-page.component.ts +++ b/apps/datahub/src/app/home/news-page/news-page.component.ts @@ -1,4 +1,5 @@ import { ChangeDetectionStrategy, Component } from '@angular/core' +import { getGlobalConfig } from '@geonetwork-ui/util/app-config' @Component({ selector: 'datahub-news-page', @@ -6,4 +7,8 @@ import { ChangeDetectionStrategy, Component } from '@angular/core' styleUrls: ['./news-page.component.css'], changeDetection: ChangeDetectionStrategy.OnPush, }) -export class NewsPageComponent {} +export class NewsPageComponent { + getContactMail(): string { + return getGlobalConfig().CONTACT_EMAIL + } +} diff --git a/conf/default.toml b/conf/default.toml index 9a744fa76c..9aab6e8b58 100644 --- a/conf/default.toml +++ b/conf/default.toml @@ -34,6 +34,8 @@ proxy_path = "" # More information about the translation can be found in the docs (https://geonetwork.github.io/geonetwork-ui/main/docs/reference/i18n.html) # languages = ['en', 'fr', 'de'] +# Enables displaying a "contact block" wherever relevant in applications +# contact_email = "opendata@mycompany.com" ### VISUAL THEME diff --git a/libs/ui/inputs/src/lib/button/button.component.ts b/libs/ui/inputs/src/lib/button/button.component.ts index 83770fcd80..123f79b3c2 100644 --- a/libs/ui/inputs/src/lib/button/button.component.ts +++ b/libs/ui/inputs/src/lib/button/button.component.ts @@ -21,50 +21,7 @@ export class ButtonComponent { @Output() buttonClick = new EventEmitter() get classList() { - return `${this.color} ${this.textColor} ${this.borderColor} ${this.extraClass}` - } - - get color() { - switch (this.type) { - case 'default': - return 'bg-gray-700 hover:bg-gray-800 hover:bg-gray-800 active:bg-gray-900' - case 'primary': - return 'bg-primary hover:bg-primary-darker focus:bg-primary-darker active:bg-primary-darkest' - case 'secondary': - return 'bg-secondary hover:bg-secondary-darker focus:bg-secondary-darker active:bg-secondary-darkest' - case 'outline': - return 'bg-white' - case 'light': - return 'bg-white hover:bg-gray-50 focus:bg-gray-50 active:bg-gray-100' - } - } - - get textColor() { - switch (this.type) { - case 'default': - case 'secondary': - case 'primary': - return 'text-white' - case 'outline': - return 'text-main hover:text-primary-darker focus:text-primary-darker active:text-primary-black' - case 'light': - return 'text-main' - } - } - - get borderColor() { - switch (this.type) { - case 'default': - return 'border border-gray-700 focus:ring-4 focus:ring-gray-200' - case 'secondary': - return 'border border-secondary focus:ring-4 focus:ring-secondary-lightest' - case 'primary': - return 'border border-primary focus:ring-4 focus:ring-primary-lightest' - case 'outline': - return 'border border-gray-300 hover:border-primary-lighter focus:border-primary-lighter focus:ring-4 focus:ring-primary-lightest active:border-primary-darker' - case 'light': - return 'border border-white focus:ring-4 focus:ring-gray-300' - } + return `btn-${this.type} ${this.extraClass}` } handleClick(event: Event) { diff --git a/libs/util/app-config/src/lib/app-config.ts b/libs/util/app-config/src/lib/app-config.ts index a01c5ae25c..35edc71193 100644 --- a/libs/util/app-config/src/lib/app-config.ts +++ b/libs/util/app-config/src/lib/app-config.ts @@ -100,6 +100,7 @@ export function loadAppConfig() { 'login_url', 'web_component_embedder_url', 'languages', + 'contact_email', ], warnings, errors @@ -126,6 +127,7 @@ export function loadAppConfig() { WEB_COMPONENT_EMBEDDER_URL: parsedGlobalSection.web_component_embedder_url, LANGUAGES: parsedGlobalSection.languages, + CONTACT_EMAIL: parsedGlobalSection.contact_email, } as GlobalConfig) const parsedLayersSections = parseMultiConfigSection( diff --git a/libs/util/app-config/src/lib/model.ts b/libs/util/app-config/src/lib/model.ts index 7eb7279395..ebf926f2ff 100644 --- a/libs/util/app-config/src/lib/model.ts +++ b/libs/util/app-config/src/lib/model.ts @@ -8,6 +8,7 @@ export interface GlobalConfig { LOGIN_URL?: string WEB_COMPONENT_EMBEDDER_URL?: string LANGUAGES?: string[] + CONTACT_EMAIL?: string } export interface LayerConfig { diff --git a/tailwind.base.css b/tailwind.base.css index c3d617cc36..7228a1dd10 100644 --- a/tailwind.base.css +++ b/tailwind.base.css @@ -7,8 +7,38 @@ @apply shadow-xl hover:shadow-xl-hover transition-shadow; } + .btn { + @apply flex flex-row items-center text-[1em] leading-none p-[1em] rounded-[0.25em] transition-all duration-100 focus:outline-none disabled:opacity-50; + } + .btn-default { - @apply bg-blue-600 text-white flex gap-3 items-center px-9 py-3 rounded-[50px] hover:scale-[1.02] transition-transform; + @apply btn text-white + bg-gray-700 hover:bg-gray-800 active:bg-gray-900 + border border-gray-700 focus:ring-4 focus:ring-gray-200; + } + + .btn-primary { + @apply btn text-white + bg-primary hover:bg-primary-darker focus:bg-primary-darker active:bg-primary-darkest + border border-primary focus:ring-4 focus:ring-primary-lightest; + } + + .btn-secondary { + @apply btn text-white + bg-secondary hover:bg-secondary-darker focus:bg-secondary-darker active:bg-secondary-darkest + border border-secondary focus:ring-4 focus:ring-secondary-lightest; + } + + .btn-outline { + @apply btn text-main + bg-white hover:text-primary-darker focus:text-primary-darker active:text-primary-black + border border-gray-300 hover:border-primary-lighter focus:border-primary-lighter focus:ring-4 focus:ring-primary-lightest active:border-primary-darker; + } + + .btn-light { + @apply btn text-main + bg-white hover:bg-gray-50 focus:bg-gray-50 active:bg-gray-100 + border border-white focus:ring-4 focus:ring-gray-300; } .badge-btn { diff --git a/translations/de.json b/translations/de.json index c7851b1cd3..20e6e1a395 100644 --- a/translations/de.json +++ b/translations/de.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "Organisationen", "datahub.header.popularRecords": "Die beliebtesten", "datahub.header.title.html": "
Entdecken Sie offene
Daten von meiner Organisation
", + "datahub.news.contact.contactus": "", + "datahub.news.contact.html": "", + "datahub.news.contact.title": "", "datahub.news.feed": "Nachrichtenfeed", "datahub.news.figures": "Indikatoren", "datahub.search.back": "Zurück zu den Ergebnissen", diff --git a/translations/en.json b/translations/en.json index 5e644ff10f..de0d52101d 100644 --- a/translations/en.json +++ b/translations/en.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "Organisations", "datahub.header.popularRecords": "The most popular", "datahub.header.title.html": "
Discover open
data from my Organization
", + "datahub.news.contact.contactus": "Contact us", + "datahub.news.contact.html": "

Do you need data that is not currently present on the platform?

Our teams are here to answer you.

", + "datahub.news.contact.title": "A specific need?", "datahub.news.feed": "News feed", "datahub.news.figures": "Indicators", "datahub.search.back": "Back to results", diff --git a/translations/es.json b/translations/es.json index 9c939e7902..f645ff47e9 100644 --- a/translations/es.json +++ b/translations/es.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "", "datahub.header.popularRecords": "", "datahub.header.title.html": "", + "datahub.news.contact.contactus": "", + "datahub.news.contact.html": "", + "datahub.news.contact.title": "", "datahub.news.feed": "", "datahub.news.figures": "", "datahub.search.back": "", diff --git a/translations/fr.json b/translations/fr.json index 84595a4888..b4dd3237c9 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "Organisations", "datahub.header.popularRecords": "Les plus appréciées", "datahub.header.title.html": "
Toutes les données
publiques de mon organisation
", + "datahub.news.contact.contactus": "Contactez-nous", + "datahub.news.contact.html": "

Vous avez besoin de données qui ne sont pas présentes sur la plateforme actuellement ?

Nos équipes sont la pour vous répondre.

", + "datahub.news.contact.title": "Un besoin spécifique ?", "datahub.news.feed": "Fil d'activité", "datahub.news.figures": "Quelques chiffres", "datahub.search.back": "Retour aux résultats", diff --git a/translations/it.json b/translations/it.json index 0492a59f8c..95d9a9a7b3 100644 --- a/translations/it.json +++ b/translations/it.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "Organizzazioni", "datahub.header.popularRecords": "Più popolari", "datahub.header.title.html": "
Tutti i dati
pubblici della mia organizzazione
", + "datahub.news.contact.contactus": "", + "datahub.news.contact.html": "", + "datahub.news.contact.title": "", "datahub.news.feed": "Feed di attività", "datahub.news.figures": "Alcune figure", "datahub.search.back": "Torna ai risultati", @@ -139,6 +142,7 @@ "downloads.format.unknown": "sconosciuto", "downloads.wfs.featuretype.not.found": "Il layer non è stato trovato", "dropFile": "Trascina il suo file", + "externalviewer.dataset.unnamed": "", "facets.block.title.OrgForResource": "Organizzazione", "facets.block.title.availableInServices": "Disponibile per", "facets.block.title.cl_hierarchyLevel.key": "Tipo di risorsa", @@ -305,6 +309,8 @@ "tooltip.html.copy": "Copiare il HTML", "tooltip.url.copy": "Copiare l'URL", "tooltip.url.open": "Aprire l'URL", + "ui.readLess": "", + "ui.readMore": "", "wfs.featuretype.notfound": "La classe di oggetto non è stata trovata nel servizio", "wfs.geojsongml.notsupported": "Il servizio non supporta il formato GeoJSON o GML", "wfs.unreachable.cors": "Il servizio non è accessibile a causa di limitazioni CORS", diff --git a/translations/nl.json b/translations/nl.json index d9facff482..a7a0178cd9 100644 --- a/translations/nl.json +++ b/translations/nl.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "", "datahub.header.popularRecords": "", "datahub.header.title.html": "", + "datahub.news.contact.contactus": "", + "datahub.news.contact.html": "", + "datahub.news.contact.title": "", "datahub.news.feed": "", "datahub.news.figures": "", "datahub.search.back": "", diff --git a/translations/pt.json b/translations/pt.json index a801e8cc6c..63b3833b70 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "", "datahub.header.popularRecords": "", "datahub.header.title.html": "", + "datahub.news.contact.contactus": "", + "datahub.news.contact.html": "", + "datahub.news.contact.title": "", "datahub.news.feed": "", "datahub.news.figures": "", "datahub.search.back": "", diff --git a/translations/sk.json b/translations/sk.json index a4b051898d..40e0c45af2 100644 --- a/translations/sk.json +++ b/translations/sk.json @@ -110,6 +110,9 @@ "datahub.header.organisations": "Organizácie", "datahub.header.popularRecords": "Najpopulárnejšie", "datahub.header.title.html": "
Objavte otvorené
dáta z mojej organizácie
", + "datahub.news.contact.contactus": "", + "datahub.news.contact.html": "", + "datahub.news.contact.title": "", "datahub.news.feed": "Spravodajský kanál", "datahub.news.figures": "Ukazovatele", "datahub.search.back": "Späť na výsledky",