Compare commits
39 Commits
3.4.0
...
148fe8eeff
| Author | SHA1 | Date | |
|---|---|---|---|
| 148fe8eeff | |||
| 8d1d47dc4f | |||
| 7b8fb380d4 | |||
| 500d9e2ea0 | |||
| 70a94990e2 | |||
| d0f10986cd | |||
| 629403fdde | |||
| 43f0f7b324 | |||
| eab6e0c31d | |||
| 805cb28185 | |||
| 54c82a7f79 | |||
| 9a62f867f1 | |||
| 0bef13c414 | |||
| 0dfcc25984 | |||
| 4c8665ebe2 | |||
| d083660f1c | |||
| e9a8b6de97 | |||
| 578e1661cd | |||
| 7882c3ecc7 | |||
| db79f912ee | |||
| 36eaa0c132 | |||
| 24c837cf84 | |||
| f32b75e31d | |||
| ce75e7ca5e | |||
| bf3a7ef261 | |||
| cae8cd3a39 | |||
| 620b496957 | |||
| 4b58117454 | |||
| 68f2080bda | |||
| 07fa86b17c | |||
| 1577ee4c27 | |||
| e0a3d391b3 | |||
| 99032f7a62 | |||
| 03f74a8181 | |||
| 405fdf297c | |||
| 5b6b6e479f | |||
| 04344808bd | |||
| 6ec27345c3 | |||
| 5e02443409 |
@@ -1,154 +0,0 @@
|
|||||||
name: release-image-gitea
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 3.*
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Set up Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: 1.3.10
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: 24.14.0
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Cache Astro Build Cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
.astro
|
|
||||||
node_modules/.vite
|
|
||||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-astro-
|
|
||||||
|
|
||||||
- name: Lint Code
|
|
||||||
run: bun run lint
|
|
||||||
|
|
||||||
- name: Build Project
|
|
||||||
run: bun run build
|
|
||||||
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Login to Registry
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.REPOSITORY_HOST }}
|
|
||||||
username: ${{ gitea.actor }}
|
|
||||||
password: ${{ secrets.REPOSITORY_TOKEN }}
|
|
||||||
|
|
||||||
- name: Login to Docker
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.DH_REGISTRY }}
|
|
||||||
username: ${{ secrets.DH_USERNAME }}
|
|
||||||
password: ${{ secrets.DH_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create Kubeconfig
|
|
||||||
run: |
|
|
||||||
mkdir $HOME/.kube
|
|
||||||
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
with:
|
|
||||||
driver: kubernetes
|
|
||||||
driver-opts: |
|
|
||||||
namespace=gitea
|
|
||||||
qemu.install=true
|
|
||||||
buildkitd-config-inline: |
|
|
||||||
[registry."docker.io"]
|
|
||||||
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
|
||||||
|
|
||||||
- name: Available Platforms
|
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
||||||
|
|
||||||
- name: Extract Metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v6
|
|
||||||
with:
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=tag
|
|
||||||
type=sha,format=long
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
images: |
|
|
||||||
${{ vars.REPOSITORY_HOST }}/${{ gitea.repository }}
|
|
||||||
|
|
||||||
- name: Get Version Info
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
|
|
||||||
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
if git describe --tags --exact-match HEAD 2>/dev/null; then
|
|
||||||
echo "is_release=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "is_release=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build and Push Image
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ steps.version.outputs.version }}
|
|
||||||
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
|
||||||
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
|
||||||
file: ./Dockerfile
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: ntfy Success
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: success()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Success - Site Profile'
|
|
||||||
priority: 3
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,successfully,completed
|
|
||||||
details: 'Image for Site Profile has been released!'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
|
|
||||||
- name: ntfy Failed
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: failure()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Failure - Site Profile'
|
|
||||||
priority: 4
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,failed
|
|
||||||
details: 'Image for Site Profile has failed to be released.'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yml", "clear": true}]'
|
|
||||||
image: true
|
|
||||||
@@ -1,154 +0,0 @@
|
|||||||
name: release-image-harbor
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 3.*
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Set up Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: 1.3.10
|
|
||||||
|
|
||||||
- name: Set up Node
|
|
||||||
uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version: 24.14.0
|
|
||||||
|
|
||||||
- name: Install Dependencies
|
|
||||||
run: bun install --frozen-lockfile
|
|
||||||
|
|
||||||
- name: Cache Astro Build Cache
|
|
||||||
uses: actions/cache@v5
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
.astro
|
|
||||||
node_modules/.vite
|
|
||||||
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-astro-
|
|
||||||
|
|
||||||
- name: Lint Code
|
|
||||||
run: bun run lint
|
|
||||||
|
|
||||||
- name: Build Project
|
|
||||||
run: bun run build
|
|
||||||
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-js
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
|
|
||||||
- name: Login to Registry
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.REGISTRY_HOST }}
|
|
||||||
username: ${{ vars.REGISTRY_USER }}
|
|
||||||
password: ${{ secrets.REGISTRY_SECRET }}
|
|
||||||
|
|
||||||
- name: Login to Docker
|
|
||||||
uses: docker/login-action@v4
|
|
||||||
with:
|
|
||||||
registry: ${{ vars.DH_REGISTRY }}
|
|
||||||
username: ${{ secrets.DH_USERNAME }}
|
|
||||||
password: ${{ secrets.DH_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create Kubeconfig
|
|
||||||
run: |
|
|
||||||
mkdir $HOME/.kube
|
|
||||||
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v4
|
|
||||||
with:
|
|
||||||
driver: kubernetes
|
|
||||||
driver-opts: |
|
|
||||||
namespace=gitea
|
|
||||||
qemu.install=true
|
|
||||||
buildkitd-config-inline: |
|
|
||||||
[registry."docker.io"]
|
|
||||||
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
|
||||||
|
|
||||||
- name: Available Platforms
|
|
||||||
run: echo ${{ steps.buildx.outputs.platforms }}
|
|
||||||
|
|
||||||
- name: Extract Metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v6
|
|
||||||
with:
|
|
||||||
tags: |
|
|
||||||
type=ref,event=branch
|
|
||||||
type=ref,event=tag
|
|
||||||
type=sha,format=long
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
images: |
|
|
||||||
${{ vars.REGISTRY_HOST }}/images/site-profile
|
|
||||||
|
|
||||||
- name: Get Version Info
|
|
||||||
id: version
|
|
||||||
run: |
|
|
||||||
echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
|
|
||||||
echo "commit=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
if git describe --tags --exact-match HEAD 2>/dev/null; then
|
|
||||||
echo "is_release=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "is_release=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build and Push Image
|
|
||||||
uses: docker/build-push-action@v7
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
build-args: |
|
|
||||||
VERSION=${{ steps.version.outputs.version }}
|
|
||||||
COMMIT_SHA=${{ steps.version.outputs.commit }}
|
|
||||||
IS_RELEASE=${{ steps.version.outputs.is_release }}
|
|
||||||
file: ./Dockerfile
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
|
|
||||||
- name: ntfy Success
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: success()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Success - Site Profile'
|
|
||||||
priority: 3
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,successfully,completed
|
|
||||||
details: 'Image for Site Profile has been released!'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
|
|
||||||
- name: ntfy Failed
|
|
||||||
uses: niniyas/ntfy-action@master
|
|
||||||
if: failure()
|
|
||||||
with:
|
|
||||||
url: '${{ secrets.NTFY_URL }}'
|
|
||||||
topic: '${{ secrets.NTFY_TOPIC }}'
|
|
||||||
title: 'Release Failure - Site Profile'
|
|
||||||
priority: 4
|
|
||||||
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
|
||||||
tags: action,failed
|
|
||||||
details: 'Image for Site Profile has failed to be released.'
|
|
||||||
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
|
||||||
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yml", "clear": true}]'
|
|
||||||
image: true
|
|
||||||
340
.gitea/workflows/release-image.yaml
Normal file
340
.gitea/workflows/release-image.yaml
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
name: release-image
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- release
|
||||||
|
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: release
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: 24.14.0
|
||||||
|
|
||||||
|
- name: Set up Bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: 1.3.10
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Cache Astro Build Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
.astro
|
||||||
|
node_modules/.vite
|
||||||
|
key: ${{ runner.os }}-astro-${{ hashFiles('**/*.astro', 'astro.config.mjs') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-astro-
|
||||||
|
|
||||||
|
- name: Lint Code
|
||||||
|
run: bun run lint
|
||||||
|
|
||||||
|
- name: Build Project
|
||||||
|
run: bun run build
|
||||||
|
|
||||||
|
- name: ntfy Failed
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Test Failure - Site Profile'
|
||||||
|
priority: 4
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,failed
|
||||||
|
details: 'During release tests failed for building Site Profile'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yaml", "clear": true}]'
|
||||||
|
image: true
|
||||||
|
|
||||||
|
guarddog:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: release
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v6
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
|
||||||
|
- name: Install GuardDog
|
||||||
|
run: |
|
||||||
|
python3 -m pip install --upgrade pip
|
||||||
|
python3 -m pip install guarddog
|
||||||
|
|
||||||
|
- name: Run GuardDog
|
||||||
|
run: |
|
||||||
|
guarddog npm scan ./
|
||||||
|
|
||||||
|
- name: ntfy Failed
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Security Failure - Site Profile'
|
||||||
|
priority: 4
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,failed
|
||||||
|
details: 'During release guarddog scan failed for Site Profile'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yaml", "clear": true}]'
|
||||||
|
image: true
|
||||||
|
|
||||||
|
semantic-release:
|
||||||
|
needs: [ build, guarddog ]
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
outputs:
|
||||||
|
new-release-published: ${{ steps.semantic.outputs.new-release-published }}
|
||||||
|
new-release-version: ${{ steps.semantic.outputs.new-release-version }}
|
||||||
|
new-release-git-tag: ${{ steps.semantic.outputs.new-release-git-tag }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version: 24.14.0
|
||||||
|
|
||||||
|
- name: Set up Bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: 1.3.10
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Run Semantic Release
|
||||||
|
id: semantic
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
|
||||||
|
NODE_PATH: ${{ github.workspace }}/node_modules
|
||||||
|
run: |
|
||||||
|
bun run semantic-release
|
||||||
|
|
||||||
|
release-harbor:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
needs: semantic-release
|
||||||
|
if: ${{ needs.semantic-release.outputs.new-release-published == 'true' }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: release
|
||||||
|
|
||||||
|
- name: Login to Harbor Registry
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.REGISTRY_HOST }}
|
||||||
|
username: ${{ vars.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_SECRET }}
|
||||||
|
|
||||||
|
- name: Login to Docker
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.DH_REGISTRY }}
|
||||||
|
username: ${{ secrets.DH_USERNAME }}
|
||||||
|
password: ${{ secrets.DH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir $HOME/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
with:
|
||||||
|
driver: kubernetes
|
||||||
|
driver-opts: |
|
||||||
|
namespace=gitea
|
||||||
|
qemu.install=true
|
||||||
|
buildkitd-config-inline: |
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
||||||
|
|
||||||
|
- name: Available Platforms
|
||||||
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
|
||||||
|
- name: Extract Metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v6
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ vars.REGISTRY_HOST }}/images/site-profile
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=sha,format=long
|
||||||
|
type=raw,value=latest,enable=${{ needs.semantic-release.outputs.new-release-published == 'true' }}
|
||||||
|
type=semver,pattern={{version}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
type=semver,pattern={{major}}.{{minor}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
type=semver,pattern={{major}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
|
||||||
|
- name: Build and Push Image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
APP_VERSION=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
COMMIT_SHA=${{ github.sha }}
|
||||||
|
IS_RELEASE=true
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: ntfy Success
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Success - Site Profile'
|
||||||
|
priority: 3
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,successfully,completed
|
||||||
|
details: 'Harbor Image for Site Profile has been released!'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
|
||||||
|
- name: ntfy Failed
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Failure - Site Profile'
|
||||||
|
priority: 4
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,failed
|
||||||
|
details: 'Harbor Image for Site Profile has failed to be released.'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yml", "clear": true}]'
|
||||||
|
image: true
|
||||||
|
|
||||||
|
release-gitea:
|
||||||
|
runs-on: ubuntu-js
|
||||||
|
needs: [ semantic-release, release-harbor ]
|
||||||
|
if: |
|
||||||
|
always() &&
|
||||||
|
needs.semantic-release.outputs.new-release-published == 'true'
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
ref: release
|
||||||
|
|
||||||
|
- name: Login to Gitea Registry
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.REPOSITORY_HOST }}
|
||||||
|
username: ${{ gitea.actor }}
|
||||||
|
password: ${{ secrets.REPOSITORY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Login to Docker
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ${{ vars.DH_REGISTRY }}
|
||||||
|
username: ${{ secrets.DH_USERNAME }}
|
||||||
|
password: ${{ secrets.DH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create Kubeconfig
|
||||||
|
run: |
|
||||||
|
mkdir $HOME/.kube
|
||||||
|
echo "${{ secrets.KUBECONFIG_BUILDX }}" > $HOME/.kube/config
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
with:
|
||||||
|
driver: kubernetes
|
||||||
|
driver-opts: |
|
||||||
|
namespace=gitea
|
||||||
|
qemu.install=true
|
||||||
|
buildkitd-config-inline: |
|
||||||
|
[registry."docker.io"]
|
||||||
|
mirrors = ["harbor.alexlebens.net/proxy-hub.docker/"]
|
||||||
|
|
||||||
|
- name: Available Platforms
|
||||||
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
|
|
||||||
|
- name: Extract Metadata
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v6
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
${{ vars.REPOSITORY_HOST }}/${{ gitea.repository }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=branch
|
||||||
|
type=sha,format=long
|
||||||
|
type=raw,value=latest,enable=${{ needs.semantic-release.outputs.new-release-published == 'true' }}
|
||||||
|
type=semver,pattern={{version}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
type=semver,pattern={{major}}.{{minor}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
type=semver,pattern={{major}},value=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
|
||||||
|
- name: Build and Push Image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
APP_VERSION=${{ needs.semantic-release.outputs.new-release-version }}
|
||||||
|
COMMIT_SHA=${{ github.sha }}
|
||||||
|
IS_RELEASE=true
|
||||||
|
file: ./Dockerfile
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
|
- name: ntfy Success
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: success()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Success - Site Profile'
|
||||||
|
priority: 3
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,successfully,completed
|
||||||
|
details: 'Gitea Image for Site Profile has been released!'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
|
||||||
|
- name: ntfy Failed
|
||||||
|
uses: niniyas/ntfy-action@master
|
||||||
|
if: failure()
|
||||||
|
with:
|
||||||
|
url: '${{ secrets.NTFY_URL }}'
|
||||||
|
topic: '${{ secrets.NTFY_TOPIC }}'
|
||||||
|
title: 'Release Failure - Site Profile'
|
||||||
|
priority: 4
|
||||||
|
headers: '{"Authorization": "Bearer ${{ secrets.NTFY_CRED }}"}'
|
||||||
|
tags: action,failed
|
||||||
|
details: 'Gitea Image for Site Profile has failed to be released.'
|
||||||
|
icon: 'https://cdn.jsdelivr.net/gh/selfhst/icons/png/gitea.png'
|
||||||
|
actions: '[{"action": "view", "label": "Open Gitea", "url": "https://gitea.alexlebens.dev/alexlebens/site-profile/actions?workflow=release-image.yaml", "clear": true}]'
|
||||||
|
image: true
|
||||||
@@ -4,6 +4,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '.gitea/workflows/**'
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
@@ -16,16 +19,16 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Set up Bun
|
|
||||||
uses: oven-sh/setup-bun@v2
|
|
||||||
with:
|
|
||||||
bun-version: 1.3.10
|
|
||||||
|
|
||||||
- name: Set up Node
|
- name: Set up Node
|
||||||
uses: actions/setup-node@v6
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24.14.0
|
node-version: 24.14.0
|
||||||
|
|
||||||
|
- name: Set up Bun
|
||||||
|
uses: oven-sh/setup-bun@v2
|
||||||
|
with:
|
||||||
|
bun-version: 1.3.10
|
||||||
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: bun install --frozen-lockfile
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
|
|||||||
17
.pre-commit-config.yaml
Normal file
17
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
repos:
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v6.0.0
|
||||||
|
hooks:
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: check-merge-conflict
|
||||||
|
- id: check-json
|
||||||
|
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||||
|
rev: v4.0.0-alpha.11
|
||||||
|
hooks:
|
||||||
|
- id: prettier
|
||||||
|
types_or: [javascript, typescript, css, scss, html, json, yaml, markdown]
|
||||||
|
additional_dependencies:
|
||||||
|
- prettier
|
||||||
|
- prettier-plugin-astro
|
||||||
|
- prettier-plugin-tailwindcss
|
||||||
18
.releaserc.json
Normal file
18
.releaserc.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"branches": ["release"],
|
||||||
|
"tagFormat": "${version}",
|
||||||
|
"plugins": [
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
"@semantic-release/changelog",
|
||||||
|
"semantic-release-export-data",
|
||||||
|
["@semantic-release/npm", { "npmPublish": false }],
|
||||||
|
["@semantic-release/git", {
|
||||||
|
"assets": ["package.json", "CHANGELOG.md"],
|
||||||
|
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
||||||
|
}],
|
||||||
|
["@saithodev/semantic-release-gitea", {
|
||||||
|
"giteaUrl": "https://gitea.alexlebens.dev"
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
13
Dockerfile
13
Dockerfile
@@ -1,4 +1,6 @@
|
|||||||
FROM dhi.io/bun:1.3.10-debian13-dev AS builder
|
ARG REGISTRY=dhi.io
|
||||||
|
FROM ${REGISTRY}/bun:1.3.10-alpine3.22-dev AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json bun.lock ./
|
COPY package.json bun.lock ./
|
||||||
@@ -15,16 +17,19 @@ FROM build-deps AS build
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN bun run build
|
RUN bun run build
|
||||||
|
|
||||||
FROM dhi.io/bun:1.3.10-alpine3.22 AS runtime
|
FROM ${REGISTRY}/bun:1.3.10-alpine3.22 AS runtime
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=prod-deps /app/node_modules /app/node_modules
|
COPY --from=prod-deps /app/node_modules /app/node_modules
|
||||||
COPY --from=build /app/dist /app/dist
|
COPY --from=build /app/dist /app/dist
|
||||||
|
|
||||||
LABEL version="3.3.0"
|
ARG APP_VERSION=latest
|
||||||
LABEL description="Astro based personal website"
|
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
ENV PORT=4321
|
ENV PORT=4321
|
||||||
|
|
||||||
|
LABEL version=$APP_VERSION
|
||||||
|
LABEL description="Astro based personal website"
|
||||||
|
|
||||||
EXPOSE $PORT
|
EXPOSE $PORT
|
||||||
CMD ["bun", "run", "./dist/server/entry.mjs"]
|
CMD ["bun", "run", "./dist/server/entry.mjs"]
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import { getSiteURL } from './src/support/url';
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: getSiteURL(),
|
site: getSiteURL(),
|
||||||
|
|
||||||
// security: { csp: true },
|
|
||||||
|
|
||||||
image: {
|
image: {
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{ protocol: 'https', hostname: '*.alexlebens.net' },
|
{ protocol: 'https', hostname: '*.alexlebens.net' },
|
||||||
@@ -26,8 +24,6 @@ export default defineConfig({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
prefetch: true,
|
|
||||||
|
|
||||||
integrations: [
|
integrations: [
|
||||||
react(),
|
react(),
|
||||||
sitemap(),
|
sitemap(),
|
||||||
|
|||||||
17
package.json
17
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "site-profile",
|
"name": "site-profile",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.3.0",
|
"version": "3.6.0",
|
||||||
"homepage": "https://www.alexlebens.dev",
|
"homepage": "https://www.alexlebens.dev",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitea.alexlebens.dev/alexlebens/site-profile/issues",
|
"url": "https://gitea.alexlebens.dev/alexlebens/site-profile/issues",
|
||||||
@@ -19,8 +19,10 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "astro dev",
|
"dev": "astro dev",
|
||||||
|
"full-dev": "rm -rf dist node_modules .astro && bun install && astro build && astro dev",
|
||||||
"build": "astro build",
|
"build": "astro build",
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
|
"full-preview": "rm -rf dist node_modules .astro && bun install && astro build && astro preview",
|
||||||
"astro": "astro",
|
"astro": "astro",
|
||||||
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx,astro}\"",
|
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,md,mdx,astro}\"",
|
||||||
"lint": "eslint \"src/**/*.{js,ts,jsx,tsx,astro}\"",
|
"lint": "eslint \"src/**/*.{js,ts,jsx,tsx,astro}\"",
|
||||||
@@ -28,7 +30,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/check": "^0.9.7",
|
"@astrojs/check": "^0.9.7",
|
||||||
"@astrojs/node": "^10.0.0",
|
"@astrojs/node": "^10.0.1",
|
||||||
"@astrojs/react": "^5.0.0",
|
"@astrojs/react": "^5.0.0",
|
||||||
"@astrojs/rss": "^4.0.17",
|
"@astrojs/rss": "^4.0.17",
|
||||||
"@astrojs/sitemap": "^3.7.1",
|
"@astrojs/sitemap": "^3.7.1",
|
||||||
@@ -43,8 +45,9 @@
|
|||||||
"@tailwindcss/vite": "^4.2.1",
|
"@tailwindcss/vite": "^4.2.1",
|
||||||
"@types/react": "^19.2.14",
|
"@types/react": "^19.2.14",
|
||||||
"@types/unist": "^3.0.3",
|
"@types/unist": "^3.0.3",
|
||||||
"astro": "^6.0.2",
|
"astro": "^6.0.4",
|
||||||
"astro-icon": "^1.1.5",
|
"astro-icon": "^1.1.5",
|
||||||
|
"dayjs": "^1.11.20",
|
||||||
"markdown-it": "^14.1.1",
|
"markdown-it": "^14.1.1",
|
||||||
"marked": "^17.0.4",
|
"marked": "^17.0.4",
|
||||||
"marked-shiki": "^1.2.1",
|
"marked-shiki": "^1.2.1",
|
||||||
@@ -62,6 +65,11 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint-react/eslint-plugin": "^2.13.0",
|
"@eslint-react/eslint-plugin": "^2.13.0",
|
||||||
|
"@saithodev/semantic-release-gitea": "^2.1.0",
|
||||||
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
||||||
|
"@semantic-release/git": "^10.0.1",
|
||||||
|
"@semantic-release/release-notes-generator": "^14.1.0",
|
||||||
"@tailwindcss/forms": "^0.5.11",
|
"@tailwindcss/forms": "^0.5.11",
|
||||||
"@tailwindcss/typography": "^0.5.19",
|
"@tailwindcss/typography": "^0.5.19",
|
||||||
"@types/markdown-it": "^14.1.2",
|
"@types/markdown-it": "^14.1.2",
|
||||||
@@ -75,7 +83,8 @@
|
|||||||
"prettier": "^3.8.1",
|
"prettier": "^3.8.1",
|
||||||
"prettier-plugin-astro": "^0.14.1",
|
"prettier-plugin-astro": "^0.14.1",
|
||||||
"prettier-plugin-tailwindcss": "^0.7.2",
|
"prettier-plugin-tailwindcss": "^0.7.2",
|
||||||
"timeago.js": "^4.0.2",
|
"semantic-release": "^25.0.3",
|
||||||
|
"semantic-release-export-data": "^1.2.0",
|
||||||
"typescript": "^5.9.3",
|
"typescript": "^5.9.3",
|
||||||
"typescript-eslint": "^8.57.0"
|
"typescript-eslint": "^8.57.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,5 +95,3 @@ const currentPath = pathname.slice(1);
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<script is:inline src="/vendor/preline/collapse2.1.0.min.js"></script>
|
|
||||||
|
|||||||
@@ -49,100 +49,88 @@
|
|||||||
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
(!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches);
|
||||||
document.documentElement.classList.toggle('dark', isDark);
|
document.documentElement.classList.toggle('dark', isDark);
|
||||||
};
|
};
|
||||||
|
|
||||||
applyTheme();
|
applyTheme();
|
||||||
|
|
||||||
document.addEventListener('astro:after-swap', applyTheme);
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function setupThemeToggle() {
|
if (!document.querySelector('.theme-switch-overlay')) {
|
||||||
const themeToggles = document.querySelectorAll('[data-theme-toggle]');
|
const overlay = document.createElement('div');
|
||||||
|
overlay.className = 'theme-switch-overlay fixed inset-0 pointer-events-none z-50';
|
||||||
// Create theme switch overlay element
|
overlay.style.opacity = '0';
|
||||||
if (!document.querySelector('.theme-switch-overlay')) {
|
overlay.style.transition = 'opacity 0.15s ease-out';
|
||||||
const overlay = document.createElement('div');
|
document.body.appendChild(overlay);
|
||||||
overlay.className = 'theme-switch-overlay fixed inset-0 pointer-events-none z-50';
|
|
||||||
overlay.style.opacity = '0';
|
|
||||||
overlay.style.transition = 'opacity 0.15s ease-out';
|
|
||||||
document.body.appendChild(overlay);
|
|
||||||
}
|
|
||||||
|
|
||||||
themeToggles.forEach((toggle) => {
|
|
||||||
['click', 'touchend'].forEach((eventType) => {
|
|
||||||
toggle.addEventListener(
|
|
||||||
eventType,
|
|
||||||
(e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
|
|
||||||
// Get click/touch position for radial animation
|
|
||||||
let x, y;
|
|
||||||
if (e.type === 'touchend' && e.changedTouches && e.changedTouches[0]) {
|
|
||||||
const rect = toggle.getBoundingClientRect();
|
|
||||||
x = e.changedTouches[0].clientX - rect.left;
|
|
||||||
y = e.changedTouches[0].clientY - rect.top;
|
|
||||||
} else {
|
|
||||||
const rect = toggle.getBoundingClientRect();
|
|
||||||
x = e.clientX - rect.left;
|
|
||||||
y = e.clientY - rect.top;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.documentElement.style.setProperty('--x', `${x}px`);
|
|
||||||
document.documentElement.style.setProperty('--y', `${y}px`);
|
|
||||||
|
|
||||||
const overlay = document.querySelector('.theme-switch-overlay');
|
|
||||||
const isDark = document.documentElement.classList.contains('dark');
|
|
||||||
const newTheme = isDark ? 'light' : 'dark';
|
|
||||||
|
|
||||||
// Show overlay during transition
|
|
||||||
if (overlay) {
|
|
||||||
overlay.style.backgroundColor =
|
|
||||||
newTheme === 'dark' ? 'rgba(24, 24, 27, 0.3)' : 'rgba(255, 255, 255, 0.3)';
|
|
||||||
overlay.style.opacity = '1';
|
|
||||||
}
|
|
||||||
|
|
||||||
document.documentElement.classList.add('theme-switching');
|
|
||||||
|
|
||||||
// Force a reflow to ensure all elements update
|
|
||||||
document.body.offsetHeight;
|
|
||||||
|
|
||||||
// Toggle dark mode with a slight delay to allow overlay to appear
|
|
||||||
setTimeout(() => {
|
|
||||||
if (isDark) {
|
|
||||||
document.documentElement.classList.remove('dark');
|
|
||||||
} else {
|
|
||||||
document.documentElement.classList.add('dark');
|
|
||||||
}
|
|
||||||
|
|
||||||
localStorage.setItem('theme', newTheme);
|
|
||||||
document.dispatchEvent(
|
|
||||||
new CustomEvent('themeChanged', {
|
|
||||||
detail: { isDark: newTheme === 'dark' },
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Force another reflow to ensure all elements update
|
|
||||||
document.body.offsetHeight;
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
if (overlay) {
|
|
||||||
overlay.style.opacity = '0';
|
|
||||||
}
|
|
||||||
document.documentElement.classList.remove('theme-switching');
|
|
||||||
}, 150);
|
|
||||||
}, 50);
|
|
||||||
},
|
|
||||||
{ passive: false }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
['click', 'touchend'].forEach((eventType) => {
|
||||||
|
document.addEventListener(
|
||||||
|
eventType,
|
||||||
|
(e) => {
|
||||||
|
const target = e.target as HTMLElement;
|
||||||
|
const toggle = target.closest('[data-theme-toggle]');
|
||||||
|
|
||||||
|
if (!toggle) return;
|
||||||
|
|
||||||
// Run setup on load
|
e.preventDefault();
|
||||||
document.addEventListener('astro:page-load', setupThemeToggle);
|
|
||||||
|
let x, y;
|
||||||
|
const rect = toggle.getBoundingClientRect();
|
||||||
|
|
||||||
|
if (eventType === 'touchend') {
|
||||||
|
const touchEvent = e as TouchEvent;
|
||||||
|
if (touchEvent.changedTouches && touchEvent.changedTouches[0]) {
|
||||||
|
x = touchEvent.changedTouches[0].clientX - rect.left;
|
||||||
|
y = touchEvent.changedTouches[0].clientY - rect.top;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const mouseEvent = e as MouseEvent;
|
||||||
|
x = mouseEvent.clientX - rect.left;
|
||||||
|
y = mouseEvent.clientY - rect.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.documentElement.style.setProperty('--x', `${x}px`);
|
||||||
|
document.documentElement.style.setProperty('--y', `${y}px`);
|
||||||
|
|
||||||
|
const overlay = document.querySelector('.theme-switch-overlay') as HTMLElement;
|
||||||
|
const isDark = document.documentElement.classList.contains('dark');
|
||||||
|
const newTheme = isDark ? 'light' : 'dark';
|
||||||
|
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.backgroundColor =
|
||||||
|
newTheme === 'dark' ? 'rgba(24, 24, 27, 0.3)' : 'rgba(255, 255, 255, 0.3)';
|
||||||
|
overlay.style.opacity = '1';
|
||||||
|
}
|
||||||
|
|
||||||
|
document.documentElement.classList.add('theme-switching');
|
||||||
|
|
||||||
|
document.body.offsetHeight;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
if (isDark) {
|
||||||
|
document.documentElement.classList.remove('dark');
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add('dark');
|
||||||
|
}
|
||||||
|
|
||||||
|
localStorage.setItem('theme', newTheme);
|
||||||
|
document.dispatchEvent(
|
||||||
|
new CustomEvent('themeChanged', {
|
||||||
|
detail: { isDark: newTheme === 'dark' },
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
document.body.offsetHeight;
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
if (overlay) {
|
||||||
|
overlay.style.opacity = '0';
|
||||||
|
}
|
||||||
|
document.documentElement.classList.remove('theme-switching');
|
||||||
|
}, 150);
|
||||||
|
}, 50);
|
||||||
|
},
|
||||||
|
{ passive: false }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
// Also run on page visibility change to ensure theme is consistent
|
|
||||||
document.addEventListener('visibilitychange', () => {
|
document.addEventListener('visibilitychange', () => {
|
||||||
if (document.visibilityState === 'visible') {
|
if (document.visibilityState === 'visible') {
|
||||||
const currentTheme = localStorage.getItem('theme');
|
const currentTheme = localStorage.getItem('theme');
|
||||||
@@ -154,7 +142,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Listen for system preference changes
|
|
||||||
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches }) => {
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', ({ matches }) => {
|
||||||
if (!localStorage.getItem('theme')) {
|
if (!localStorage.getItem('theme')) {
|
||||||
if (matches) {
|
if (matches) {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
data-astro-prefetch
|
data-astro-prefetch
|
||||||
>
|
>
|
||||||
<div class="relative grow overflow-hidden">
|
<div class="relative grow overflow-hidden">
|
||||||
<div class="absolute inset-1 flex flex-col p-3 md:p-4 lg:p-5">
|
<div class="mask-fade-edges absolute inset-1 flex flex-col p-3 md:p-4 lg:p-5">
|
||||||
<div class="flex flex-row items-center mb-4">
|
<div class="flex flex-row items-center mb-4 shrink-0">
|
||||||
<div class="card-hover-icon-scale shrink-0 mr-3">
|
<div class="card-hover-icon-scale shrink-0 mr-3">
|
||||||
<Logo
|
<Logo
|
||||||
srcLight={getDirectusImageURL(logoLight)}
|
srcLight={getDirectusImageURL(logoLight)}
|
||||||
@@ -35,12 +35,12 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
{title}
|
{title}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="overflow-hidden">
|
||||||
<p class="card-text-description mb-4">
|
<p class="card-text-description line-clamp-3">
|
||||||
{description}
|
{description}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-text-description flex items-center justify-between text-xs mt-auto pt-1 md:pt-2">
|
<div class="card-text-description flex shrink-0 items-center justify-between text-xs mt-auto pt-1 md:pt-2">
|
||||||
<span class="inline-flex items-center">
|
<span class="inline-flex items-center">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
@@ -55,7 +55,7 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
</svg>
|
</svg>
|
||||||
{count}
|
{count}
|
||||||
</span>
|
</span>
|
||||||
<span class="inline-flex items-center">
|
<div class="inline-flex items-center">
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="16"
|
width="16"
|
||||||
@@ -68,8 +68,10 @@ const { slug, title, description, logoLight, logoDark, count, publishDate } = As
|
|||||||
<circle cx="12" cy="12" r="10"></circle>
|
<circle cx="12" cy="12" r="10"></circle>
|
||||||
<polyline points="12 6 12 12 16 14"></polyline>
|
<polyline points="12 6 12 12 16 14"></polyline>
|
||||||
</svg>
|
</svg>
|
||||||
{publishDate}
|
<span>
|
||||||
</span>
|
{publishDate}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const { dayName, label, icon, temp } = Astro.props;
|
|||||||
---
|
---
|
||||||
|
|
||||||
<div class="smooth-reveal-2 group flex flex-col">
|
<div class="smooth-reveal-2 group flex flex-col">
|
||||||
<div class="card-base w-40">
|
<div class="card-base w-32 sm:w-40">
|
||||||
<div class="p-5 text-center">
|
<div class="p-5 text-center">
|
||||||
<span class="card-text-description block font-bold text-xs uppercase tracking-widest">
|
<span class="card-text-description block font-bold text-xs uppercase tracking-widest">
|
||||||
{dayName}
|
{dayName}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type { Post } from '@lib/directusTypes';
|
|||||||
import CategoryCard from '@components/cards/CategoryCard.astro';
|
import CategoryCard from '@components/cards/CategoryCard.astro';
|
||||||
import LargeCategoryCard from '@components/cards/LargeCategoryCard.astro';
|
import LargeCategoryCard from '@components/cards/LargeCategoryCard.astro';
|
||||||
import directus from '@lib/directus';
|
import directus from '@lib/directus';
|
||||||
import { timeago } from '@support/time';
|
import { formatFromNow } from '@support/time';
|
||||||
|
|
||||||
const global = await directus.request(readSingleton('site_global'));
|
const global = await directus.request(readSingleton('site_global'));
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ const categories = (await directus.request(readItems('categories')))
|
|||||||
logoLight={category.logoLight}
|
logoLight={category.logoLight}
|
||||||
logoDark={category.logoDark}
|
logoDark={category.logoDark}
|
||||||
count={postMap.get(category.slug)?.length ?? 0}
|
count={postMap.get(category.slug)?.length ?? 0}
|
||||||
publishDate={timeago(postMap.get(category.slug)?.[0]?.published_date)}
|
publishDate={formatFromNow(postMap.get(category.slug)?.[0]?.published_date)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -106,7 +106,7 @@ const categories = (await directus.request(readItems('categories')))
|
|||||||
logoLight={global.all_logoLight}
|
logoLight={global.all_logoLight}
|
||||||
logoDark={global.all_logoDark}
|
logoDark={global.all_logoDark}
|
||||||
count={posts.length}
|
count={posts.length}
|
||||||
publishDate={timeago(posts[0]?.published_date)}
|
publishDate={formatFromNow(posts[0]?.published_date)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ const images = await Promise.all(imagesData.map(async (img) => ({
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.addEventListener('astro:page-load', () => {
|
function initHeroImage() {
|
||||||
const container = document.getElementById('hero-image-container');
|
const container = document.getElementById('hero-image-container');
|
||||||
if (container) {
|
if (container) {
|
||||||
const images = container.querySelectorAll('.hero-image');
|
const images = container.querySelectorAll('.hero-image');
|
||||||
@@ -96,5 +96,13 @@ const images = await Promise.all(imagesData.map(async (img) => ({
|
|||||||
images[randomIndex].classList.add('flex');
|
images[randomIndex].classList.add('flex');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
if (document.readyState === 'loading') {
|
||||||
|
document.addEventListener('DOMContentLoaded', initHeroImage);
|
||||||
|
} else {
|
||||||
|
initHeroImage();
|
||||||
|
}
|
||||||
|
if ((window as any).swup) {
|
||||||
|
(window as any).swup.hooks.on('page:view', initHeroImage);
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
const { posts, title, subTitle } = Astro.props;
|
const { posts, title, subTitle } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="max-w-340 2xl:max-w-full px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto mb-2 md:mb-8">
|
<section class="max-w-340 2xl:max-w-full px-4 sm:px-6 lg:px-8 py-10 lg:py-14 mx-auto mb-2 md:mb-4">
|
||||||
<div class="text-center max-w-2xl mx-auto mb-10 lg:mb-14">
|
<div class="text-center max-w-2xl mx-auto mb-10 lg:mb-14">
|
||||||
<h1 class="smooth-reveal card-text-header block">
|
<h1 class="smooth-reveal card-text-header block">
|
||||||
{title}
|
{title}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ interface Props {
|
|||||||
const { posts } = Astro.props;
|
const { posts } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
<section class="smooth-reveal flex flex-col gap-4 md:mb-20">
|
<section class="smooth-reveal-cards flex flex-col gap-4 md:mb-20">
|
||||||
{posts.map((post, index) => index % 2 === 0 ? (
|
{posts.map((post, index) => index % 2 === 0 ? (
|
||||||
<LargeBlogLeftCard post={post}/>
|
<LargeBlogLeftCard post={post}/>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const { forecastDays, error } = await getFiveDayForecast(latitude, longitude, ti
|
|||||||
</div>
|
</div>
|
||||||
{error ? (
|
{error ? (
|
||||||
<div class="card-base p-10 text-accent text-center">
|
<div class="card-base p-10 text-accent text-center">
|
||||||
Sorry, {error.toLowerCase}
|
Sorry, {error.toLowerCase()}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div class="flex flex-wrap justify-center gap-4 lg:gap-6">
|
<div class="flex flex-wrap justify-center gap-4 lg:gap-6">
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
import { ClientRouter } from 'astro:transitions';
|
|
||||||
import { readSingleton } from '@directus/sdk';
|
import { readSingleton } from '@directus/sdk';
|
||||||
|
|
||||||
import BaseHead from '@components/BaseHead.astro';
|
import BaseHead from '@components/BaseHead.astro';
|
||||||
@@ -39,8 +38,7 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
structuredData={structuredData}
|
structuredData={structuredData}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ClientRouter fallback="swap" />
|
<!-- Set Theme -->
|
||||||
|
|
||||||
<script is:inline>
|
<script is:inline>
|
||||||
const theme = (() => {
|
const theme = (() => {
|
||||||
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
|
if (typeof localStorage !== 'undefined' && localStorage.getItem('theme')) {
|
||||||
@@ -60,6 +58,12 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
window.localStorage.setItem('theme', theme);
|
window.localStorage.setItem('theme', theme);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<!-- Preline -->
|
||||||
|
<script
|
||||||
|
src="/vendor/preline/collapse2.1.0.min.js"
|
||||||
|
is:inline
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Rybbit Tracking Snippet -->
|
<!-- Rybbit Tracking Snippet -->
|
||||||
<script
|
<script
|
||||||
src="https://rybbit.alexlebens.dev/api/script.js"
|
src="https://rybbit.alexlebens.dev/api/script.js"
|
||||||
@@ -104,7 +108,52 @@ const normalizeTitle = !title ? global.name : `${title} | ${global.name}`;
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
resetScroll();
|
resetScroll();
|
||||||
document.addEventListener('astro:after-swap', resetScroll);
|
|
||||||
|
document.addEventListener('swup:page:view', () => {
|
||||||
|
resetScroll();
|
||||||
|
if (typeof (window as any).HSStaticMethods !== 'undefined') {
|
||||||
|
(window as any).HSStaticMethods.autoInit();
|
||||||
|
}
|
||||||
|
if (typeof (window as any).rybbit === 'function') {
|
||||||
|
(window as any).rybbit('trackPageview');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const animateContent = () => {
|
||||||
|
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
||||||
|
smoothReveal.forEach((el, index) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
}, 50 + index * 100);
|
||||||
|
});
|
||||||
|
|
||||||
|
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
||||||
|
smoothReveal2.forEach((el, index) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
}, 200 + index * 250);
|
||||||
|
});
|
||||||
|
|
||||||
|
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
||||||
|
smoothRevealCards.forEach((el, index) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
el.classList.add('animate-reveal');
|
||||||
|
}, 400 + index * 250);
|
||||||
|
});
|
||||||
|
|
||||||
|
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
||||||
|
smoothRevealFade.forEach((el, index) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
el.classList.add('animate-reveal-fade');
|
||||||
|
}, 100 + index * 250);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
animateContent();
|
||||||
|
|
||||||
|
document.addEventListener('swup:page:view', animateContent);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -86,24 +86,6 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
const randomFact = funFacts[Math.floor(Math.random() * funFacts.length)];
|
const randomFact = funFacts[Math.floor(Math.random() * funFacts.length)];
|
||||||
funFactElement.textContent = randomFact;
|
funFactElement.textContent = randomFact;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
100 + index * 150
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
@@ -47,33 +47,3 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
50 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate with just fade in with staggered delay
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
},
|
|
||||||
100 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -52,56 +52,3 @@ const posts = await directus.request(
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
50 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate group 2
|
|
||||||
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
|
||||||
smoothReveal2.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
200 + index * 150
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate topic cards with staggered delay
|
|
||||||
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
|
||||||
smoothRevealCards.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
500 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate with just fade in with staggered delay
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
},
|
|
||||||
100 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -37,23 +37,3 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
<ApplicationSection className="smooth-reveal-2" />
|
<ApplicationSection className="smooth-reveal-2" />
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
50 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -174,21 +174,4 @@ const content = marked.parse(post.content || '');
|
|||||||
|
|
||||||
lightbox.init();
|
lightbox.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
100 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -57,56 +57,3 @@ const recentPosts: Post[] = posts.filter(
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
200 + index * 300
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate group 2
|
|
||||||
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
|
||||||
smoothReveal2.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
500 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate topic cards with staggered delay
|
|
||||||
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
|
||||||
smoothRevealCards.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
1000 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate with just fade in with staggered delay
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
},
|
|
||||||
100 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -75,56 +75,3 @@ const categoriesPosts = posts
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
50 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate group 2
|
|
||||||
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
|
||||||
smoothReveal2.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
200 + index * 150
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate topic cards with staggered delay
|
|
||||||
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
|
||||||
smoothRevealCards.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
500 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate with just fade in with staggered delay
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
},
|
|
||||||
100 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -37,56 +37,3 @@ const global = await directus.request(readSingleton('site_global'));
|
|||||||
<CategorySection />
|
<CategorySection />
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
50 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate group 2
|
|
||||||
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
|
||||||
smoothReveal2.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
200 + index * 150
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate topic cards with staggered delay
|
|
||||||
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
|
||||||
smoothRevealCards.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
500 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate with just fade in with staggered delay
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
},
|
|
||||||
100 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -55,6 +55,12 @@ const recentPosts = posts
|
|||||||
|
|
||||||
<FeatureSection />
|
<FeatureSection />
|
||||||
|
|
||||||
|
<RecentPostsSection
|
||||||
|
posts={recentPosts}
|
||||||
|
title="Latest Posts"
|
||||||
|
subTitle="Checkout my most recent thoughts here"
|
||||||
|
/>
|
||||||
|
|
||||||
<WeatherSection
|
<WeatherSection
|
||||||
server:defer
|
server:defer
|
||||||
latitude={weather.latitude}
|
latitude={weather.latitude}
|
||||||
@@ -63,12 +69,6 @@ const recentPosts = posts
|
|||||||
timezone={weather.timezone}
|
timezone={weather.timezone}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<RecentPostsSection
|
|
||||||
posts={recentPosts}
|
|
||||||
title="Latest Posts"
|
|
||||||
subTitle="Checkout my most recent thoughts here"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<GiteaSection
|
<GiteaSection
|
||||||
title="Follow me on Gitea"
|
title="Follow me on Gitea"
|
||||||
subTitle="I love open source and have my code availabile on my Gitea server."
|
subTitle="I love open source and have my code availabile on my Gitea server."
|
||||||
@@ -76,62 +76,3 @@ const recentPosts = posts
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|
||||||
<script>
|
|
||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
50 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate group 2
|
|
||||||
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
|
||||||
smoothReveal2.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
200 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate topic cards with staggered delay
|
|
||||||
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
|
||||||
smoothRevealCards.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
400 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate with just fade in with staggered delay
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
},
|
|
||||||
100 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
|
|
||||||
const observer = new MutationObserver(() => {
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
|
|
||||||
observer.observe(document.body, { childList: true, subtree: true });
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|||||||
@@ -138,3 +138,15 @@
|
|||||||
bg-neutral-100 dark:bg-neutral-800
|
bg-neutral-100 dark:bg-neutral-800
|
||||||
shadow-xs dark:shadow-md
|
shadow-xs dark:shadow-md
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@utility mask-fade-edges {
|
||||||
|
-webkit-mask-image:
|
||||||
|
linear-gradient(to right, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent),
|
||||||
|
linear-gradient(to bottom, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent);
|
||||||
|
mask-image:
|
||||||
|
linear-gradient(to right, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent),
|
||||||
|
linear-gradient(to bottom, transparent, black var(--fade-dist, 1rem), black calc(100% - var(--fade-dist, 1rem)), transparent);
|
||||||
|
|
||||||
|
-webkit-mask-composite: source-in;
|
||||||
|
mask-composite: intersect;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
// Add smooth reveal animations for content after loading
|
|
||||||
document.addEventListener('astro:page-load', () => {
|
|
||||||
const animateContent = () => {
|
|
||||||
// Animate group 1
|
|
||||||
const smoothReveal = document.querySelectorAll('.smooth-reveal');
|
|
||||||
smoothReveal.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
50 + index * 100
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate group 2
|
|
||||||
const smoothReveal2 = document.querySelectorAll('.smooth-reveal-2');
|
|
||||||
smoothReveal2.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
200 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate topic cards with staggered delay
|
|
||||||
const smoothRevealCards = document.querySelectorAll('.smooth-reveal-cards');
|
|
||||||
smoothRevealCards.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal');
|
|
||||||
},
|
|
||||||
400 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Animate with just fade in with staggered delay
|
|
||||||
const smoothRevealFade = document.querySelectorAll('.smooth-reveal-fade');
|
|
||||||
smoothRevealFade.forEach((el, index) => {
|
|
||||||
setTimeout(
|
|
||||||
() => {
|
|
||||||
el.classList.add('animate-reveal-fade');
|
|
||||||
},
|
|
||||||
100 + index * 250
|
|
||||||
);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
animateContent();
|
|
||||||
});
|
|
||||||
@@ -1,34 +1,13 @@
|
|||||||
import { format, register } from 'timeago.js';
|
import dayjs from 'dayjs';
|
||||||
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
|
||||||
const TimeAgoConfiguration: string[][] = [
|
dayjs.extend(relativeTime);
|
||||||
['today', 'today'],
|
|
||||||
['%s seconds ago', 'in %s seconds'],
|
|
||||||
['1 minute ago', 'in 1 minute'],
|
|
||||||
['%s minutes ago', 'in %s minutes'],
|
|
||||||
['1 hour ago', 'in 1 hour'],
|
|
||||||
['%s hours ago', 'in %s hours'],
|
|
||||||
['1 day ago', 'in 1 day'],
|
|
||||||
['%s days ago', 'in %s days'],
|
|
||||||
['1 week ago', 'in 1 week'],
|
|
||||||
['%s weeks ago', 'in %s weeks'],
|
|
||||||
['1 month ago', 'in 1 month'],
|
|
||||||
['%s months ago', 'in %s months'],
|
|
||||||
['1 year ago', 'in 1 year'],
|
|
||||||
['%s years ago', 'in %s years'],
|
|
||||||
];
|
|
||||||
|
|
||||||
function timeago(date?: Date): string {
|
function formatFromNow(date: Date | null): string {
|
||||||
if (!date) {
|
if (!date) {
|
||||||
return 'today';
|
return 'none';
|
||||||
}
|
}
|
||||||
|
return dayjs(date).fromNow()
|
||||||
const localeFunc = (number: number, index: number, _?: number): [string, string] => {
|
|
||||||
return TimeAgoConfiguration[index] as [string, string];
|
|
||||||
};
|
|
||||||
|
|
||||||
register('timeago', localeFunc);
|
|
||||||
|
|
||||||
return format(date, 'timeago');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(date: Date): string {
|
function formatDate(date: Date): string {
|
||||||
@@ -46,4 +25,4 @@ function formatShortDate(date: Date): string {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export { formatDate, formatShortDate, timeago };
|
export { formatFromNow, formatDate, formatShortDate, };
|
||||||
|
|||||||
Reference in New Issue
Block a user