hyprland-website/src/routes/+page.server.js

72 lines
1.8 KiB
JavaScript
Raw Normal View History

Update design - use Sveltekit (#28) * first push * feature cards, hall of fame * playing around * community slice * home * mobile home * wtf happend with the git * something * stuff * stuff * remove blur on nav on mobile * wall of fame, improve performance * always use current year for copyright * close navbar on navigation for mobile * improve performance community slice * improve performance features slice * prepare performance improvement for rice thumbnails * . * . * more stuff * new hero effect experiment * . * work * . * . * more stuf * hide discord profile image if image is not loaded yet * update links to rices * . * fix postinstall not running * . * remove quotes * remove .gitattributes * update readme * Footer: Fix bottom margin * HeroBackground: Remove images+animations * Remove discord * InstallSection: Change button label * Revert "Remove discord" This reverts commit 3e3eab848c71d24cbefca70f8108cc2ac7e843ea. * Revert "HeroBackground: Remove images+animations" This reverts commit 4979bf2a3942ae125a5e429eb14ab68690ee1531. * improve hero rice * small improvments * small css adjustments * update Hero * upgrade dependencies * fix prettier * improve navbar on mobile * add top ricers to community slice * improve hero * improve preview slice * add plugins section * Add OpenSus * set min width for quotes in discord profiles * update nix install command * improve patternbackground mouse follow * improve pattern mouse follow * fix play button for autoplay blocked users * pluginsSlice, sync videos playback state * add fullscreen button to videos * clean up package.json * slide pluginsSlice video on hover on desktop * PluginsSlice: small improvments * priotize loading logo * add meta tags * previewRice: make fullscreen button bigger * pluginSlice fix fullscreen btn with sliding * update readme * fix typo * ssr logo as svg Use the svg directly so that it does not need to get fetched anymore * pluginsSlice: animate in * communityslice: sort by size * communityslice: add a profile * walloffame cleanup * WallOfFame: Nicer wisdoms * add grain to gradients * decrease grain strength * remove unused imports * add space winners * small clean up * use aylur settings video * increase grain strength * fix grain path * contest: date as pill * famedrice: colored titles * update Aylurs video * pluginsSlice: decrease video gap * pluginsSlice: improve mobile padding * pluginSlice: improve play btn position * installSlice: improve padding on mobile * add flick0s rice as honorable mention * rename WoF to HoF * add Slackware * Revert "add Slackware" This reverts commit defc756cc6bc1549111e0d8e415545a107375bc9. * Revert "add flick0s rice as honorable mention" This reverts commit 8cffcad8cb330062bf6bedf230f7c6272fe79775. * add outfoxxeds plugin video * pluginSlice: update outfoxxed caption * pluginSlice: outfoxxed video thumb * pluginsSlice: refractor, add outfoxxed thumbnail * video: Fix autoplay detection for Firefox * Video: Fix poster size * reencode aylurs file bc firefox errors * PreviewRice: refactor * remove console.log * PluginsSlice: fix playback sync logic * update readme * fix typo * also use more modern encoding for videos * pluginsSlice: Improve outfoxxed caption * InstallSlice: Shorten NixOs command for formatting * HoF: Fix japane decorative title on mobile * PluginsSlice: Improve video display on mobile * PluginsSlice: Improve caption padding on mobile * PluginsSlice: outfoxxed all lowercase * fix typ * remove no-index * HoF: Update japanese wisdom * remove unused dependency * fix grammar * blurredImages: add shebang * HoF: Use data file to generate rices * use discord link as constant * heroBgTile: smooth fade-out of img * Video: Add pause button * pluginSlice: add slide in button * remove AV1 webm video and only use h264 mp4 * video: small play button plays video * pluginsSlice: nicer slide button * reeconde end_4 rice, delete unused AV1 video files * HeroBackground: use transition for artwork tiles
2023-11-25 21:31:55 +01:00
// since there's no dynamic data here, we can prerender
// it so that it gets served as a static asset in production
import baseColors from 'tailwindcss/colors'
export const load = () => ({
backgroundData: getHeroBackgroundTiles()
})
function getHeroBackgroundTiles() {
const workspacesPerRow = 4
const workspaceHeight = 240
const gapLength = 32
const colors = [baseColors.blue[500], baseColors.cyan[400], baseColors.sky[500]]
const images = [
'/imgs/chan/joy.svg',
'/imgs/chan/surprise.svg',
'/imgs/chan/tongueout.svg',
'/imgs/waylnad.webp'
]
const leftColumns = Array.from({ length: 3 }, () => generateRow(workspacesPerRow))
const rightColumns = Array.from({ length: 3 }, () => generateRow(workspacesPerRow))
/** Used to transform the rows by their own lenght*/
const height = workspacesPerRow * (workspaceHeight + gapLength)
return {
leftColumns,
rightColumns,
height,
workspacesPerRow,
workspaceHeight,
gapLength
}
function generateRow(amount) {
return Array.from({ length: amount }).map(generateWorkspace)
// If the background should be animated
// return [...base, ...base]
}
function generateWorkspace() {
return [
generateTiles(),
Math.random() > 0.4 ? generateTiles() : undefined,
Math.random() > 0.7 ? generateTiles() : undefined
].filter(Boolean)
}
function generateTiles() {
const result = Math.random() > 0.5 ? [generateTile()] : [generateTile(), generateTile()]
return result
}
function generateTile() {
return { color: getRandomColor(), image: Math.random() > 0.7 ? getRandomImage() : undefined }
}
/** @returns {string} */
function getRandomColor() {
return colors.at(Math.floor(Math.random() * colors.length))
}
/** @returns {string} */
function getRandomImage() {
return images.at(Math.floor(Math.random() * images.length))
}
}