Skip to content

Commit

Permalink
Merge pull request #21 from NovaGaia/feat/15-multi-refs
Browse files Browse the repository at this point in the history
test build without tina generated
  • Loading branch information
hrenaud authored Feb 15, 2024
2 parents d69a7e7 + 2e5673d commit cf5d353
Show file tree
Hide file tree
Showing 89 changed files with 565 additions and 3,930 deletions.
31 changes: 31 additions & 0 deletions .env-bkp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Hosting utils
GITHUB_BRANCH=main
GITHUB_OWNER=NovaGaia
GITHUB_REPO=nova-astro-site
GITHUB_PERSONAL_ACCESS_TOKEN=**
TINA_PUBLIC_IS_LOCAL=true
MONGODB_URI=mongodb+srv://contact:bRAbxJfJbr7NE4Jf@cluster0.3ncciwx.mongodb.net/
NEXTAUTH_SECRET=***
NEXTAUTH_URL=http://localhost:3000/api/tina
# Ref utils
# SITE_URL=https://novagaia.github.io/
# SITE_URL=https://778fgbggop.preview.infomaniak.website/
SITE_URL=http://localhost:4321
# PUBLIC_BASE=2024-greenit-refs
# PUBLIC_BASE=rweb
PUBLIC_BASE=
PUBLIC_REF_NAME=RWEB
TINA_PUBLIC_REF_NAME=RWEB
# PUBLIC_REPO_URL=https://github.com/cnumr/best-practices-wordpress
PUBLIC_REPO_URL=https://github.com/NovaGaia/2024-greenit-refs
PUBLIC_REPO_BRANCH=main
# BASE_URL=https://novagaia.github.io/2024-greenit-refs
BASE_URL=https://778fgbggop.preview.infomaniak.website/rweb
# BASE_URL=http://localhost:4321/

# mangodb
username: contact
password: bRAbxJfJbr7NE4Jf

https://novagaia.github.io/2024-greenit-refs/fr
https://novagaia.github.io/2024-greenit-refs/fr/
34 changes: 34 additions & 0 deletions .env-cmdrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"dev": {
"SITE_URL": "http://localhost:4321",
"PUBLIC_REPO_URL": "https://github.com/NovaGaia/2024-greenit-refs",
"PUBLIC_REPO_BRANCH": "main",
"BASE_URL": "http://localhost:4321/"
},
"prod": {
"SITE_URL": "https://778fgbggop.preview.infomaniak.website/",
"PUBLIC_REPO_URL": "https://github.com/NovaGaia/2024-greenit-refs",
"PUBLIC_REPO_BRANCH": "main",
"BASE_URL": "https://778fgbggop.preview.infomaniak.website/rweb"
},
"rweb-prod": {
"PUBLIC_BASE": "rweb",
"PUBLIC_REF_NAME": "RWEB",
"TINA_PUBLIC_REF_NAME": "RWEB"
},
"rweb-dev": {
"PUBLIC_BASE": "",
"PUBLIC_REF_NAME": "RWEB",
"TINA_PUBLIC_REF_NAME": "RWEB"
},
"rwp-prod": {
"PUBLIC_BASE": "rwp",
"PUBLIC_REF_NAME": "RWP",
"TINA_PUBLIC_REF_NAME": "RWP"
},
"rwp-dev": {
"PUBLIC_BASE": "",
"PUBLIC_REF_NAME": "RWP",
"TINA_PUBLIC_REF_NAME": "RWP"
}
}
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: npm install

- name: Run build task
run: npm run build
run: npm run ci:build
env:
SITE_URL: ${{ vars.SITE_URL }}
PUBLIC_BASE: ${{ vars.PUBLIC_BASE }}
Expand Down
310 changes: 10 additions & 300 deletions LICENSE

Large diffs are not rendered by default.

40 changes: 33 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,39 @@
"type": "module",
"version": "0.0.1",
"scripts": {
"dev": "env-cmd tinacms dev -c \"astro dev\"",
"start": "env-cmd astro dev",
"local:build": "env-cmd astro build",
"build": "astro build",
"sync": "env-cmd astro sync",
"check:build": "env-cmd astro check && astro build",
"preview": "env-cmd astro preview --base $(PUBLIC_BASE)",
"---CI---": "echo nothing to see here",
"ci:build": "tinacms build --local --skip-cloud-checks && astro build",
"---FAST-(DEFAULT-RWEB)---": "echo nothing to see here",
"start": "npm run dev",
"dev": "npm run dev:local:rweb",
"build": "npm run build:local:rweb",
"preview": "npm run preview:local:rweb",
"---LOCAL-RWEB---": "echo nothing to see here",
"dev:local:rweb": "env-cmd -e dev,rweb-dev tinacms dev -c \"astro dev\"",
"build:local:rweb": "env-cmd -e dev,rweb-dev tinacms build --local --skip-cloud-checks && env-cmd -e dev,rweb-dev astro build",
"sync:local:rweb": "env-cmd -e dev,rweb-dev astro sync",
"check:local:rweb": "env-cmd -e dev,rweb-dev astro check",
"preview:local:rweb": "env-cmd -x -e dev,rweb-dev astro preview --base \\$PUBLIC_BASE",
"---LOCAL-RWP---": "echo nothing to see here",
"dev:local:rwp": "env-cmd -e dev,rwp-dev tinacms dev -c \"astro dev\"",
"build:local:rwp": "env-cmd -e dev,rwp-dev tinacms build --local --skip-cloud-checks && env-cmd -e dev,rwp-dev astro build",
"sync:local:rwp": "env-cmd -e dev,rwp-dev astro sync",
"check:local:rwp": "env-cmd -e dev,rwp-dev astro check",
"preview:local:rwp": "env-cmd -x -e dev,rwp-dev astro preview --base \\$PUBLIC_BASE",
"---PROD-RWEB---": "echo nothing to see here",
"build:prod:rweb": "npm run build:tina:prod:rweb && npm run build:astro:prod:rweb",
"build:tina:prod:rweb": "env-cmd -e prod,rweb-prod tinacms build --local --skip-cloud-checks",
"build:astro:prod:rweb": "env-cmd -e prod,rweb-prod astro build",
"---PROD-RWP---": "echo nothing to see here",
"build:prod:rwp": "npm run build:tina:prod:rwp && npm run build:astro:prod:rwp",
"build:tina:prod:rwp": "env-cmd -e prod,rwp-prod tinacms build --local --skip-cloud-checks",
"build:astro:prod:rwp": "env-cmd -e prod,rwp-prod astro build",
"---BKP---": "echo nothing to see here",
"bkp:tinacms:build": "tinacms build --local --skip-cloud-checks",
"bkp:dev": "tinacms dev -c \"astro dev\"",
"bkp:astro:build": "astro build",
"bkp:astro:sync": "env-cmd astro sync",
"bkp:astro:check:build": "env-cmd astro check && astro build",
"format": "prettier -w --plugin-search-dir=. .",
"astro": "astro",
"tina": "tinacms"
Expand Down
12 changes: 8 additions & 4 deletions referentiel-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const getRefConfig: RefConfig = (specificRef) => {
environmental_impact: MESURE_ON_3,
moe: false,
tiers: false,
perimetre: false,
scope: false,
},
};
switch (currentRef) {
Expand All @@ -79,7 +79,7 @@ export const getRefConfig: RefConfig = (specificRef) => {
config.featuresEnabled.environmental_impact = MESURE_ON_3;
config.featuresEnabled.moe = false;
config.featuresEnabled.tiers = false;
config.featuresEnabled.perimetre = true;
config.featuresEnabled.scope = true;
break;

case "RWEB":
Expand All @@ -94,13 +94,17 @@ export const getRefConfig: RefConfig = (specificRef) => {
en: { short: "Web Performance", long: " for Web Performance" },
fr: { short: "Performance Web", long: " pour Performance Web" },
};
config.refInformations = {
currentVersion: "4.0.0",
creationYear: 2012,
};
config.featuresEnabled.lexique = false;
config.featuresEnabled.linkToPersonas = false;
config.featuresEnabled.priority_implementation = MESURE_ON_5;
config.featuresEnabled.priority_implementation = "false";
config.featuresEnabled.environmental_impact = MESURE_ON_5;
config.featuresEnabled.moe = true;
config.featuresEnabled.tiers = true;
config.featuresEnabled.perimetre = false;
config.featuresEnabled.scope = false;
break;

default:
Expand Down
Binary file added src/assets/img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/img_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/vue-font-forge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 2 additions & 49 deletions src/components/CardView.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import { getLangFromUrl, useTranslations } from "@i18n/utils";
import { slugify } from "@js/utils";
import type { CollectionEntry } from "astro:content";
import Card from "./Card";
import FichesCard from "./fiches/FichesCard.astro";
const REF_NAME = process.env.PUBLIC_REF_NAME;
Expand Down Expand Up @@ -58,54 +58,7 @@ const [, ...entry_slug] = entry.slug.split("/");
>
{
type === Card.FICHES ? (
<div
class="mb-0 mt-0 text-lg font-bold text-neutral md:grid md:grid-cols-[2fr_1fr] md:grid-rows-2 md:gap-2"
data-lifecycle={slugify(entry.data.lifecycle)}
data-scope={slugify(entry.data.scope)}
data-saved_resources={slugify(entry.data.saved_resources.join(" "))}
>
<h2 class="m-0 flex flex-row items-start text-lg font-bold text-neutral md:col-span-1 md:row-span-2">
<span class="badge mr-2 whitespace-nowrap border-primary bg-primary">
{REF_NAME} {entry.data.refID}
</span>
<span>{entry.data.title}</span>
</h2>
<div class="flex flex-row items-center justify-end gap-2">
<span
title={t("Priorité d'implémentation")}
aria-label={`${t("Priorité d'implémentation")} : ${
entry.data[`priority_implementation`]
}`}
role="img"
>
{t(cleanImpact("priority_implementation"))}
</span>
<span>|</span>
<span
title={t("Impact environnemental")}
aria-label={`${t("Impact environnemental")} : ${
entry.data[`environmental_impact`]
}`}
role="img"
>
{t(cleanImpact("environmental_impact"))}
</span>
</div>
<div class="mt-2 flex flex-row items-center justify-end gap-2 md:mt-0 md:gap-4">
<span
title={t("lifecycle")}
class="badge border-primary text-xs text-neutral"
>
{t(entry.data.lifecycle)}
</span>
<span
title={t("scope")}
class="badge border-primary text-xs text-neutral"
>
{t(entry.data.scope)}
</span>
</div>
</div>
<FichesCard entry={entry} />
) : (
<h3 class="mt-0">{entry.data.title}</h3>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const translatePath = useTranslatedPath(lang);
</li>
<li>
<a
href={translatePath("/mentions-legales")}
href={translatePath("/mentions-legales.html")}
title={t("Les mentions légales du site.")}
>
{t("Mentions légales")}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const translatePath = useTranslatedPath(lang);
</li>
<li class="!m-0">
<a
href={translatePath("/fiches")}
href={translatePath("/fiches.html")}
class={`text-white text-xl lg:text-base no-underline text-inherit font-medium`}
title={t("Consulter les Bonnes pratiques")}
>
Expand All @@ -79,7 +79,7 @@ const translatePath = useTranslatedPath(lang);
).featuresEnabled.lexique && (
<li class="!m-0">
<a
href={translatePath("/lexique")}
href={translatePath("/lexique.html")}
class={`text-xl font-medium text-inherit text-white no-underline lg:text-base`}
title={t("Consulter le Lexique")}
>
Expand Down
48 changes: 25 additions & 23 deletions src/components/LanguagePicker.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
import { languages } from "@i18n/ui";
import { code_languages, languages } from "@i18n/ui";
import {
getLangFromUrl,
useTranslatedPath,
Expand All @@ -15,25 +15,27 @@ const translatePath = useTranslatedPath(lang);
const t = useTranslations(lang);
---

<label for="lang-select"
><span class="sr-only">{t("Language picker")}</span>
<select
id="lang-select"
onchange="window.location.href = this.value"
class:list={[
"rounded-sm py-1 text-sm font-bold",
{
"bg-green-600 text-white lg:bg-slate-600 lg:text-white":
style === "dark",
"bg-white text-slate-900": style === "light",
},
]}
>
<option>{t("Changer de langue")}</option>
{
Object.entries(languages).map(([language, label]) => (
<option value={translatePath(``, language)}>{label}</option>
))
}
</select>
</label>
{
code_languages.length > 1 && (
<label for="lang-select">
<span class="sr-only">{t("Language picker")}</span>
<select
id="lang-select"
onchange="window.location.href = this.value"
class:list={[
"rounded-sm py-1 text-sm font-bold",
{
"bg-green-600 text-white lg:bg-slate-600 lg:text-white":
style === "dark",
"bg-white text-slate-900": style === "light",
},
]}
>
<option>{t("Changer de langue")}</option>
{Object.entries(languages).map(([language, label]) => (
<option value={translatePath(``, language)}>{label}</option>
))}
</select>
</label>
)
}
14 changes: 0 additions & 14 deletions src/components/fiches/FicheCard.astro

This file was deleted.

8 changes: 4 additions & 4 deletions src/components/fiches/FicheVersionDisplay.astro
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ const { versions } = Astro.props;

<div class="box my-4 border-neutral-transparent lg:my-8">
<div class="grid w-fit grid-flow-col grid-rows-2 gap-2">
<div class="font-bold">Ref. Version</div>
<div class="font-bold">Ref. BP</div>
<div class="text-right font-bold">Ref. Version</div>
<div class="text-right font-bold">Ref. BP</div>
{
versions.map((data) => {
return (
<>
<div>→ {data.version}</div>
<div>→ {data.idRef}</div>
<div class="text-center font-semibold">{data.version}</div>
<div class="text-center">{data.idRef}</div>
</>
);
})
Expand Down
4 changes: 4 additions & 0 deletions src/components/fiches/FicheViewPaginate.astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ type PrevNext = {
next: CollectionEntry<"fiches"> | null;
};
const PUBLIC_REF_NAME =
import.meta.env.PUBLIC_REF_NAME || process.env.PUBLIC_REF_NAME;
function generatePrevNext(entries, current, lang): PrevNext {
const filteredEntries = entries
.filter((entry) => entry.data.refType === PUBLIC_REF_NAME)
.filter((entry) => entry.slug.split("/")[0] === lang)
.filter((entry) =>
import.meta.env.MODE === "development" ? "true" : entry.data.published,
Expand Down
Loading

0 comments on commit cf5d353

Please sign in to comment.