From 44432bc4263d65b8f5c66554bc9d206f52bf2c99 Mon Sep 17 00:00:00 2001 From: Joonas Somero Date: Wed, 19 Feb 2025 12:14:22 +0200 Subject: [PATCH 1/7] Enable deployment workflow --- .github/workflows/deployment.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 2121170bd97c..df7a79a9899b 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -8,7 +8,6 @@ on: jobs: build: - if: false runs-on: ubuntu-22.04 steps: @@ -35,7 +34,6 @@ jobs: path: dist/ deploy: - if: false runs-on: ubuntu-latest needs: build From b1b40d0a864510757296f54fc7920cf67b849fae Mon Sep 17 00:00:00 2001 From: Joonas Somero Date: Wed, 19 Feb 2025 12:31:03 +0200 Subject: [PATCH 2/7] Explicit version numbers --- .github/workflows/deployment.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index df7a79a9899b..b8cf331a7cd9 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4.2.2 with: ref: rewrite/main @@ -29,7 +29,7 @@ jobs: - name: Upload artifact id: deployment - uses: actions/upload-pages-artifact@3 + uses: actions/upload-pages-artifact@v3.0.1 with: path: dist/ @@ -48,4 +48,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@4 + uses: actions/deploy-pages@v4.0.5 From 541b857415f22a7bbdd29750728a77d8ce7e0b2a Mon Sep 17 00:00:00 2001 From: Joonas Somero Date: Wed, 19 Feb 2025 13:31:05 +0200 Subject: [PATCH 3/7] Explicit build steps --- .github/workflows/deployment.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index b8cf331a7cd9..0bd3928a2b8c 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -24,8 +24,16 @@ jobs: - name: Install Node.js packages run: npm install - - name: Build site - run: npm run build + - name: Build stylesheets using Tailwind CSS + run: npm run-script tailwindcss -- --minify + + - name: Build React components using Webpack + run: npm run-script webpack -- --mode=production + + - name: Build site using Jekyll + env: + JEKYLL_ENV: production + run: npm run-script jekyll:build -- --baseurl ${{ github.event.repository.name }} - name: Upload artifact id: deployment From 2f2f0347bc1a72a4901f7fc79948f7a2a68aa4e1 Mon Sep 17 00:00:00 2001 From: Joonas Somero Date: Wed, 19 Feb 2025 15:25:46 +0200 Subject: [PATCH 4/7] Pass relative urls through SITE --- content/site.js | 16 ++++++++++++++++ src/components/Home.jsx | 20 +++++++++++++------- src/components/NavigationHeader.jsx | 26 +++++++++----------------- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/content/site.js b/content/site.js index 654a7d1a2f51..97ae0e699ad2 100644 --- a/content/site.js +++ b/content/site.js @@ -1,5 +1,20 @@ --- --- +{%- assign values = site.data.site-constants -%} + +{%- capture constants -%} +{ + "logo": "{{ values.logo | relative_url }}", + "nav": [ + { "title": "Home", "href": "{{ '/' | relative_url }}", "key": 0 }, + { "title": "Get started", "href": "{{ '/pages/access' | relative_url }}", "key": 1 }, + { "title": "About", "href": "{{ '/pages/about' | relative_url }}", "key": 2 }, + { "title": "Blogs and instructions", "href": "{{ '/pages/publications' | relative_url }}", "key": 3 }, + { "title": "Status", "href": "{{ '/pages/status' | relative_url }}", "key": 4 }, + { "title": "Events", "href": "{{ '/pages/events' | relative_url }}", "key": 5 } + ] +} +{%- endcapture -%} {%- capture blogs -%} [ @@ -32,6 +47,7 @@ {%- endcapture -%} const SITE = { + constants: JSON.parse(String.raw`{{- constants -}}`), blogs: JSON.parse(String.raw`{{- blogs -}}`), events: JSON.parse(String.raw`{{- events -}}`), } diff --git a/src/components/Home.jsx b/src/components/Home.jsx index 09a31e17c16a..66654f37ec62 100644 --- a/src/components/Home.jsx +++ b/src/components/Home.jsx @@ -10,8 +10,8 @@ const style = { "--_c-icon-color": "white" }; -const ContentButton = ({ text, href }) => { - const isActive = window.location.pathname === href; +const ContentButton = props => { + const isActive = window.location.pathname === props.href; var styleClass = "text-white text-md py-3" if (isActive) { @@ -23,9 +23,9 @@ const ContentButton = ({ text, href }) => { className='w-min ml-[20px] mt-[10px] md:ml-0 md:mr-[20px] sm:ml-0 sm:ml-[30px]' no-radius style={style} - onClick={() => (window.location.href = href)} + onClick={() => (window.location.href = props.href)} > -

{text}

+

{props.title}

); @@ -34,6 +34,14 @@ const ContentButton = ({ text, href }) => { export const Home = () => { const test_lg = 500; const test = 'flex flex-col justify-evenly z-2 bg-orange-200 min-h-[100px] pl-[30px]' + const nav = SITE.constants.nav + const contentButtons = [ + "Get started", + "Blogs and instructions", + "About" + ].map(title => nav.find(page => page.title === title)) + .map(page => ) + return (
@@ -54,9 +62,7 @@ export const Home = () => { How to access Helmi, instructions
- - - + { contentButtons }
diff --git a/src/components/NavigationHeader.jsx b/src/components/NavigationHeader.jsx index 13fd89eb631e..8f0b946052b2 100644 --- a/src/components/NavigationHeader.jsx +++ b/src/components/NavigationHeader.jsx @@ -11,8 +11,8 @@ const style = { "--_c-icon-color": "black" }; -const NavButton = ({ text, href }) => { - const isActive = window.location.pathname === href; +const NavButton = props => { + const isActive = window.location.pathname === props.href; var styleClass = "text-black py-2" if (isActive) { @@ -24,9 +24,9 @@ const NavButton = ({ text, href }) => { className='w-min' text style={style} - onClick={() => (window.location.href = href)} + onClick={() => (window.location.href = props.href)} > -

{text}

+

{props.title}

); }; @@ -53,13 +53,15 @@ export const NavigationHeader = () => { const toggleMenu = () => setIsOpen(!isOpen); + const pageButtons = SITE.constants.nav.map(page => ) + return (
{isOpen &&
- - - - - - + { pageButtons }
} From e28a870cc597538f2fe47ee80784e9ad3ef4d1c9 Mon Sep 17 00:00:00 2001 From: Joonas Somero Date: Fri, 7 Mar 2025 09:51:37 +0200 Subject: [PATCH 5/7] Associate js files under content/ with Liquid --- .vscode/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f7af08199c46..972819d29020 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { "files.associations": { - "**/content/**/*.html": "liquid" + "**/content/**/*.{html,js}": "liquid", } -} \ No newline at end of file +} From c284e3df39563381a2498536be1e54f4255aba87 Mon Sep 17 00:00:00 2001 From: Joonas Somero Date: Fri, 7 Mar 2025 09:54:15 +0200 Subject: [PATCH 6/7] Adjust navigation --- content/site.js | 21 +++++++++++++-------- src/components/Home.jsx | 12 ++++++------ src/components/NavigationHeader.jsx | 21 +++++++++++---------- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/content/site.js b/content/site.js index 9c964a75a9a6..9a6a2fe57d21 100644 --- a/content/site.js +++ b/content/site.js @@ -5,13 +5,18 @@ {%- capture constants -%} { "logo": "{{ values.logo | relative_url }}", - "nav": [ - { "title": "Home", "href": "{{ '/' | relative_url }}", "key": 0 }, - { "title": "Get started", "href": "{{ '/pages/access' | relative_url }}", "key": 1 }, - { "title": "About", "href": "{{ '/pages/about' | relative_url }}", "key": 2 }, - { "title": "Blogs and instructions", "href": "{{ '/pages/publications' | relative_url }}", "key": 3 }, - { "title": "Status", "href": "{{ '/pages/status' | relative_url }}", "key": 4 }, - { "title": "Events", "href": "{{ '/pages/events' | relative_url }}", "key": 5 } + "baseUrl": "{{ site.baseurl }}", + "topNav": [ + { "title": "Home", "href": "{{ site.baseurl }}", "key": 0 }, + { "title": "Blogs and instructions", "href": "{{ '/publications' | relative_url }}", "key": 1 }, + { "title": "Status", "href": "{{ '/status' | relative_url }}", "key": 2 }, + { "title": "Events", "href": "{{ '/events' | relative_url }}", "key": 3 }, + { "title": "Search", "href": "{{ '/search' | relative_url }}", "key": 4 } + ], + "cardNav": [ + { "title": "How to get access", "href": "{{ '/access' | relative_url }}", "key": 5 }, + { "title": "Blogs and instructions", "href": "{{ '/publications' | relative_url }}", "key": 6 }, + { "title": "About FiQCI", "href": "{{ '/about' | relative_url }}", "key": 7 } ] } {%- endcapture -%} @@ -52,7 +57,7 @@ "key": "{{ forloop.index }}", "type": "Event", "title": "{{ event_post.title }}", - "url": "{{ event_post.link }}", + "url": "{{ event_post.link | relative_url }}", "date": "{{ event_post.date | date: '%-d.%-m.%Y' }}", "content": {{ event_post.content | strip_html | strip_newlines | jsonify }}, "filters": { diff --git a/src/components/Home.jsx b/src/components/Home.jsx index c01300ccb465..38c49a08004a 100644 --- a/src/components/Home.jsx +++ b/src/components/Home.jsx @@ -34,13 +34,13 @@ const ContentButton = props => { export const Home = () => { const test_lg = 500; const test = 'flex flex-col justify-evenly z-2 bg-orange-200 min-h-[100px] pl-[30px]' - const nav = SITE.constants.nav + const nav = SITE.constants.cardNav const contentButtons = [ - "Get started", - "Blogs and instructions", - "About" - ].map(title => nav.find(page => page.title === title)) - .map(page => ) + ["How to get access", mdiArrowDown], + ["Blogs and instructions", mdiArrowRight], + ["About FiQCI", mdiArrowRight], + ].map(([title, icon]) => [nav.find(page => page.title === title), icon]) + .map(([page, icon]) => ) return (
diff --git a/src/components/NavigationHeader.jsx b/src/components/NavigationHeader.jsx index a1bcc126bc0e..bb4669ad6229 100644 --- a/src/components/NavigationHeader.jsx +++ b/src/components/NavigationHeader.jsx @@ -30,20 +30,18 @@ const NavButton = props => { ); }; -const NavSearchButton = ({ text, href }) => { +const NavSearchButton = props => { return ( -
(window.location.href = href)} + onClick={() => (window.location.href = props.href)} > -

{text}

+

{props.title}

-
); }; @@ -51,7 +49,12 @@ export const NavigationHeader = () => { const [isOpen, setIsOpen] = useState(false); const navRef = useRef(null); const toggleMenu = () => setIsOpen((prev) => !prev); - const pageButtons = SITE.constants.nav.map(page => ); + + const pageButtons = SITE.constants.topNav.map( + page => page.title != "Search" + && + || + ); // This effect adds event listeners when the menu is open. // It will close the menu if a click or touch happens outside the navbar. @@ -82,7 +85,7 @@ export const NavigationHeader = () => {