Files
pages/src/routes/projects/projectn5/devlog/+page.svelte

282 lines
7.5 KiB
Svelte
Raw Normal View History

2025-03-31 23:07:29 +02:00
<script lang="ts">
import BannerTitleAlt from "$lib/banner-title-alt.svelte";
import Content from "$lib/content.svelte";
2025-08-26 18:21:05 +02:00
import type { DevlogPost } from "./devlog-posts";
import { posts } from "./devlog-posts";
import { onMount } from 'svelte';
interface DevlogLiveEntry {
timestamp: string;
text: string;
}
let entries: DevlogLiveEntry[] = $state([]);
onMount(() => {
getRecentEntries();
});
async function getRecentEntries() {
let response = await fetch("https://server.denizk0461.dev:2761/recentEntries")
let data = await response.json();
data.forEach(datum => {
var date = new Date(datum.Timestamp)
console.log(datum.Timestamp)
entries.push({
timestamp: `${date.getFullYear()}-${leftpad(date.getMonth() + 1)}-${leftpad(date.getDate())} ${leftpad(date.getHours())}:${leftpad(date.getMinutes())}`,
text: datum.Text,
})
});
console.log(data)
};
// Leftpads a single-digit number to two digits
function leftpad(n: number): String {
var result = n.toString();
if (n < 10) {
result = "0" + result
}
return result;
}
2025-03-31 23:07:29 +02:00
</script>
2025-04-04 10:37:25 +02:00
<svelte:head>
<title>Project N5 Devlog | denizk0461</title>
</svelte:head>
<BannerTitleAlt
title="Project N5; Development Log"
banner="/projects/projectn5/devlog/2024/0323/unity_overview.webp"
wide
/>
2025-04-04 10:37:25 +02:00
<Content>
<p>This is the development log for my game <strong>Project N5</strong>! It's an action-adventure jump-and-run game inspired by games such as Ratchet & Clank. Development started on <b>2023-09-16</b> and rebooted on <b>2025-05-16</b>.</p>
<p>2023 progress updates summarise an entire month's work, respectively. Progress updates thereafter denote noteworthy developments in a more collected format.</p>
<div class="post-container">
{#each posts as post, index}
{@render devlogPost({post, index})}
{/each}
</div>
</Content>
{#snippet liveUpdate({entry}: {entry: DevlogLiveEntry})}
<div class="live-devlog-entry notched-small">
<p class="live-devlog-entry-time">{entry.timestamp}</p>
<p class="live-devlog-entry-content">{entry.text}</p>
</div>
{/snippet}
2025-04-04 10:37:25 +02:00
{#snippet devlogPost({post, index}: {post: DevlogPost, index: number})}
<div class="post-supercontainer">
<a href="/projects/projectn5/devlog/{post.date}/" class="post">
<div class="post-img-container">
<img class="post-img" src="/projects/projectn5/devlog/previews/{post.date}.webp" alt="Preview image for devlog {post.title}">
<!-- <p class="post-number">#{posts.length - index}</p> -->
</div>
<div class="post-text-container">
{#if post.subtitle}
<p class="post-date">#{posts.length - index} // {post.subtitle}</p>
{:else}
<p class="post-date">#{posts.length - index} ~</p>
{/if}
<p class="post-title">{post.title}</p>
</div>
</a>
</div>
2025-04-04 10:37:25 +02:00
{/snippet}
<style>
:root {
--color-laura: #C76668CC;
--color-laura-darker: #A55051CC;
}
/* Live update list */
.live-devlog-panel {
margin: 16px;
}
.live-devlog-container {
display: flex;
gap: 4px;
margin: 0 16px;
flex-direction: column;
}
.live-devlog-entry {
background-color: var(--color-background-highlight-hover);
}
.live-devlog-entry-time {
font-family: var(--font-mono);
font-size: 0.8rem;
font-weight: 700;
width: 100%;
background-color: #00000066;
}
.live-devlog-entry-content, .live-devlog-entry-time {
padding: 8px 16px;
margin: 0;
}
.live-devlog-entry-content {
font-size: 1.0rem;
}
/* Post list */
.post-supercontainer {
width: 30%;
}
2025-04-04 10:37:25 +02:00
.post-container {
max-width: 1600px;
2025-04-04 10:37:25 +02:00
margin-left: auto;
margin-right: auto;
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.post {
text-decoration: none;
background-color: #00000044;
display: flex;
flex-direction: row;
justify-content: flex-start;
padding: 16px;
transition: background-color 0.16s ease-in-out;
margin: 4px;
--notch-size-devlog: 42px;
--notch-size-devlog-img: 36px;
2025-04-04 10:37:25 +02:00
clip-path: polygon(
0% var(--notch-size-devlog),
var(--notch-size-devlog) 0%,
calc(100% - var(--notch-size-devlog)) 0%,
100% var(--notch-size-devlog),
100% calc(100% - var(--notch-size-devlog)),
calc(100% - var(--notch-size-devlog)) 100%,
var(--notch-size-devlog) 100%,
0% calc(100% - var(--notch-size-devlog))
);
}
.post:hover {
background-color: var(--color-background-highlight-hover);
}
.post:hover .post-title, .post:hover .post-date, .post-number {
2025-04-04 10:37:25 +02:00
color: var(--color-text-dark);
}
.post:hover .post-img-container {
background-color: transparent;
}
.post-img-container {
position: relative;
height: fit-content;
width: fit-content;
/* background-color: var(--color-background-highlight-hover); */
transition: background-color 0.16s ease-in-out;
clip-path: polygon(
0% var(--notch-size-devlog-img),
var(--notch-size-devlog-img) 0%,
calc(100% - var(--notch-size-devlog-img)) 0%,
100% var(--notch-size-devlog-img),
100% calc(100% - var(--notch-size-devlog-img)),
100% 100%,
var(--notch-size-devlog-img) 100%,
0% calc(100% - var(--notch-size-devlog-img))
);
}
2025-04-04 10:37:25 +02:00
.post-img {
width: 150px;
height: 120px;
margin: 0;
object-fit: cover;
clip-path: polygon(
0% 0%,
100% 0%,
100% 0%,
100% 0%,
100% calc(100% - var(--notch-size-devlog-img)),
calc(100% - var(--notch-size-devlog-img)) 100%,
0% 100%,
0% 100%
);
2025-04-04 10:37:25 +02:00
}
.post-text-container {
display: flex;
flex-direction: column;
padding-left: 24px;
justify-content: center;
}
.post-date, .post-title, .post-number {
2025-04-04 10:37:25 +02:00
font-family: 'Space Mono', monospace;
margin: 4px 0;
transition: color 0.16s ease-in-out;
}
.post-date {
font-size: 1.1rem;
font-weight: 500;
}
.post-title {
font-size: 1.3rem;
font-weight: 700;
}
.post-number {
font-size: 0.77rem;
font-weight: 700;
position: absolute;
right: 2px;
bottom: 1px;
margin: 0;
padding: 0;
line-height: 1rem;
}
@media screen and (max-width: 1700px) {
.post-supercontainer {
width: 50% !important;
}
}
@media screen and (max-width: 1200px) {
.post-supercontainer {
width: 100% !important;
}
}
@media screen and (max-width: 800px) {
.post {
--notch-size-devlog: 24px;
--notch-size-devlog-img: 18px;
}
.post-img {
width: 100px;
height: 70px;
}
.post-date {
font-size: 0.8rem;
line-height: 0.9rem;
}
.post-title {
font-size: 1.0rem;
line-height: 1.1rem;
}
}
2025-04-04 10:37:25 +02:00
</style>