-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c455725
commit 14e3ef9
Showing
11 changed files
with
6,636 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Liman Webpage Build Pipeline | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Cache dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('package-lock.json') }} | ||
restore-keys: npm- | ||
|
||
- name: Cache next build | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.npm | ||
${{ github.workspace }}/.next/cache | ||
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s', '**/*.[jt]sx') }} | ||
restore-keys: | | ||
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | ||
- name: Build Next application | ||
run: | | ||
npm ci --ignore-build | ||
npm run build | ||
[ "$GITHUB_REF" == "refs/heads/master" ] && PRERELEASE=false || PRERELEASE=true | ||
echo "PRERELEASE=$(echo $PRERELEASE)" >> $GITHUB_ENV | ||
echo "UI_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | ||
- name: Move Next standalone files and build package | ||
run: | | ||
cp -r public/ .next/standalone/ | ||
cp -r .next/static .next/standalone/.next/ | ||
TMP_DIR=/tmp/liman-website | ||
DEBIAN_PATH=$TMP_DIR/DEBIAN | ||
SERVER_BIN_PATH=$TMP_DIR/liman/website | ||
rm -rf $TMP_DIR | ||
mkdir $TMP_DIR | ||
mkdir $DEBIAN_PATH | ||
mkdir -p $SERVER_BIN_PATH | ||
cp ./build/debian/control $DEBIAN_PATH/control | ||
sed -i s/%VERSION%/${{ github.run_number }}/g $DEBIAN_PATH/control | ||
cat $DEBIAN_PATH/control | ||
cp ./build/debian/postinst $DEBIAN_PATH/postinst | ||
chmod 775 $DEBIAN_PATH/postinst | ||
mv -r .next/standalone $SERVER_BIN_PATH | ||
dpkg-deb --build $TMP_DIR | ||
mv /tmp/liman-website.deb /tmp/liman-website-x64.deb | ||
rm -rf $DEBIAN_PATH | ||
sed -i s/%VERSION%/${{ github.run_number }}/g build/rhel/website.spec | ||
rpmbuild -ba build/rhel/website.spec --define "_app_dir $TMP_DIR" --define "_rpmdir /tmp" --define "_rpmfilename liman-website-x64.rpm" | ||
- name: Release 🚀 | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
with: | ||
files: /tmp/liman-${{ env.UI_BRANCH }}-${{ github.run_number }}.zip | ||
name: "Release ${{ env.UI_BRANCH }} ${{ github.run_number }}" | ||
tag_name: "release.${{ env.UI_BRANCH }}.${{ github.run_number }}" | ||
prerelease: ${{ env.PRERELEASE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
"use client" | ||
|
||
import React, { useEffect, useRef, useState } from "react" | ||
|
||
import MousePosition from "@/lib/mouse-position" | ||
|
||
type SpotlightProps = { | ||
children: React.ReactNode | ||
className?: string | ||
} | ||
|
||
export default function Spotlight({ | ||
children, | ||
className = "", | ||
}: SpotlightProps) { | ||
const containerRef = useRef<HTMLDivElement>(null) | ||
const mousePosition = MousePosition() | ||
const mouse = useRef<{ x: number; y: number }>({ x: 0, y: 0 }) | ||
const containerSize = useRef<{ w: number; h: number }>({ w: 0, h: 0 }) | ||
const [boxes, setBoxes] = useState<Array<HTMLElement>>([]) | ||
|
||
useEffect(() => { | ||
containerRef.current && | ||
setBoxes( | ||
Array.from(containerRef.current.children).map((el) => el as HTMLElement) | ||
) | ||
}, []) | ||
|
||
useEffect(() => { | ||
initContainer() | ||
window.addEventListener("resize", initContainer) | ||
|
||
return () => { | ||
window.removeEventListener("resize", initContainer) | ||
} | ||
}, [setBoxes]) | ||
|
||
useEffect(() => { | ||
onMouseMove() | ||
}, [mousePosition]) | ||
|
||
const initContainer = () => { | ||
if (containerRef.current) { | ||
containerSize.current.w = containerRef.current.offsetWidth | ||
containerSize.current.h = containerRef.current.offsetHeight | ||
} | ||
} | ||
|
||
const onMouseMove = () => { | ||
if (containerRef.current) { | ||
const rect = containerRef.current.getBoundingClientRect() | ||
const { w, h } = containerSize.current | ||
const x = mousePosition.x - rect.left | ||
const y = mousePosition.y - rect.top | ||
const inside = x < w && x > 0 && y < h && y > 0 | ||
if (inside) { | ||
mouse.current.x = x | ||
mouse.current.y = y | ||
boxes.forEach((box) => { | ||
const boxX = | ||
-(box.getBoundingClientRect().left - rect.left) + mouse.current.x | ||
const boxY = | ||
-(box.getBoundingClientRect().top - rect.top) + mouse.current.y | ||
box.style.setProperty("--mouse-x", `${boxX}px`) | ||
box.style.setProperty("--mouse-y", `${boxY}px`) | ||
}) | ||
} | ||
} | ||
} | ||
|
||
return ( | ||
<div className={className} ref={containerRef}> | ||
{children} | ||
</div> | ||
) | ||
} | ||
|
||
type SpotlightCardProps = { | ||
children: React.ReactNode | ||
className?: string | ||
} | ||
|
||
export function SpotlightCard({ | ||
children, | ||
className = "", | ||
}: SpotlightCardProps) { | ||
return ( | ||
<div | ||
className={`relative h-full overflow-hidden rounded-3xl bg-slate-800 p-px before:pointer-events-none before:absolute before:-left-40 before:-top-40 before:z-10 before:h-80 before:w-80 before:translate-x-[var(--mouse-x)] before:translate-y-[var(--mouse-y)] before:rounded-full before:bg-slate-400 before:opacity-0 before:blur-[100px] before:transition-opacity before:duration-500 after:pointer-events-none after:absolute after:-left-48 after:-top-48 after:z-30 after:h-96 after:w-96 after:translate-x-[var(--mouse-x)] after:translate-y-[var(--mouse-y)] after:rounded-full after:bg-indigo-500 after:opacity-0 after:blur-[100px] after:transition-opacity after:duration-500 after:hover:opacity-10 before:group-hover:opacity-100 ${className}`} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
reactStrictMode: true, | ||
trailingSlash: true, | ||
skipTrailingSlashRedirect: true, | ||
distDir: "dist", | ||
swcMinify: true, | ||
output: "standalone", | ||
} | ||
|
||
export default nextConfig |
Oops, something went wrong.