feat: dynamically determine game of life width

chore: format astro files
This commit is contained in:
log101 2024-06-22 13:02:22 +03:00
parent a2c28ef377
commit ea496f4182
14 changed files with 3493 additions and 37 deletions

View File

@ -1 +1,12 @@
{} {
"plugins": ["prettier-plugin-astro"],
"bracketSameLine": true,
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
}

49
package-lock.json generated
View File

@ -16,7 +16,8 @@
}, },
"devDependencies": { "devDependencies": {
"cypress": "^13.11.0", "cypress": "^13.11.0",
"prettier": "3.2.5" "prettier": "^3.2.5",
"prettier-plugin-astro": "^0.14.0"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@ -5992,6 +5993,26 @@
"url": "https://github.com/prettier/prettier?sponsor=1" "url": "https://github.com/prettier/prettier?sponsor=1"
} }
}, },
"node_modules/prettier-plugin-astro": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.14.0.tgz",
"integrity": "sha512-7jRGJsexaRIyUzTk8uzXlP45cw6DQ5Ci4bTe0xCBCcuO1Fff8jJy9oI+kRCQKSdDFTSAArMSg8GpvzlKBtSaZA==",
"devOptional": true,
"dependencies": {
"@astrojs/compiler": "^1.5.5",
"prettier": "^3.0.0",
"sass-formatter": "^0.7.6"
},
"engines": {
"node": "^14.15.0 || >=16.0.0"
}
},
"node_modules/prettier-plugin-astro/node_modules/@astrojs/compiler": {
"version": "1.8.2",
"resolved": "https://registry.npmjs.org/@astrojs/compiler/-/compiler-1.8.2.tgz",
"integrity": "sha512-o/ObKgtMzl8SlpIdzaxFnt7SATKPxu4oIP/1NL+HDJRzxfJcAkOTAb/ZKMRyULbz4q+1t2/DAebs2Z1QairkZw==",
"devOptional": true
},
"node_modules/pretty-bytes": { "node_modules/pretty-bytes": {
"version": "5.6.0", "version": "5.6.0",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz",
@ -6796,6 +6817,12 @@
"tslib": "^2.1.0" "tslib": "^2.1.0"
} }
}, },
"node_modules/s.color": {
"version": "0.0.15",
"resolved": "https://registry.npmjs.org/s.color/-/s.color-0.0.15.tgz",
"integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==",
"devOptional": true
},
"node_modules/safe-buffer": { "node_modules/safe-buffer": {
"version": "5.2.1", "version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
@ -6822,6 +6849,15 @@
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
"dev": true "dev": true
}, },
"node_modules/sass-formatter": {
"version": "0.7.9",
"resolved": "https://registry.npmjs.org/sass-formatter/-/sass-formatter-0.7.9.tgz",
"integrity": "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==",
"devOptional": true,
"dependencies": {
"suf-log": "^2.5.3"
}
},
"node_modules/section-matter": { "node_modules/section-matter": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz", "resolved": "https://registry.npmjs.org/section-matter/-/section-matter-1.0.0.tgz",
@ -7245,6 +7281,15 @@
"node": ">=16 || 14 >=14.17" "node": ">=16 || 14 >=14.17"
} }
}, },
"node_modules/suf-log": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz",
"integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==",
"devOptional": true,
"dependencies": {
"s.color": "0.0.15"
}
},
"node_modules/supports-color": { "node_modules/supports-color": {
"version": "5.5.0", "version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
@ -7454,7 +7499,7 @@
"version": "2.6.2", "version": "2.6.2",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz",
"integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==",
"devOptional": true "dev": true
}, },
"node_modules/tunnel-agent": { "node_modules/tunnel-agent": {
"version": "0.6.0", "version": "0.6.0",

View File

@ -19,6 +19,7 @@
}, },
"devDependencies": { "devDependencies": {
"cypress": "^13.11.0", "cypress": "^13.11.0",
"prettier": "3.2.5" "prettier": "^3.2.5",
"prettier-plugin-astro": "^0.14.0"
} }
} }

View File

@ -4,8 +4,7 @@
<div class="comment border-gray-400 border border-solid pt-1 pb-6 ml-4"> <div class="comment border-gray-400 border border-solid pt-1 pb-6 ml-4">
<p <p
class="font-semibold pl-3 pr-2 pb-1 border-b border-x-0 border-t-0 border-gray-400 border-solid" class="font-semibold pl-3 pr-2 pb-1 border-b border-x-0 border-t-0 border-gray-400 border-solid">
>
Arafat Candan Arafat Candan
</p> </p>

View File

@ -26,8 +26,7 @@ const backendHost = import.meta.env.PUBLIC_BACKEND_HOST;
hx-post=`${backendHost}/api/blog/comments` hx-post=`${backendHost}/api/blog/comments`
hx-target="#comments-container" hx-target="#comments-container"
hx-swap="afterbegin" hx-swap="afterbegin"
hx-on::after-request="document.getElementById('no-comments-text')?.remove();this.reset()" hx-on::after-request="document.getElementById('no-comments-text')?.remove();this.reset()">
>
<div class="p-1 flex flex-col flex-end items-end gap-3"> <div class="p-1 flex flex-col flex-end items-end gap-3">
<textarea <textarea
class="textarea py-2 px-3 w-full box-border" class="textarea py-2 px-3 w-full box-border"

View File

@ -16,15 +16,13 @@ const backendHost = import.meta.env.PUBLIC_BACKEND_HOST;
<form <form
hx-post=`${backendHost}/api/blog/forms/emoji` hx-post=`${backendHost}/api/blog/forms/emoji`
hx-target="#reaction-buttons" hx-target="#reaction-buttons">
>
<input type="hidden" name="postId" value=`${entryId}` /> <input type="hidden" name="postId" value=`${entryId}` />
<div <div
id="reaction-buttons" id="reaction-buttons"
hx-get=`${backendHost}/api/blog/forms/emoji?postId=${entryId}` hx-get=`${backendHost}/api/blog/forms/emoji?postId=${entryId}`
hx-trigger="load" hx-trigger="load"
hx-swap="innerHTML" hx-swap="innerHTML">
>
<div class="emoji-buttons-container"> <div class="emoji-buttons-container">
<button name="emojiInput" value="👍" type="submit" class="emoji-button" <button name="emojiInput" value="👍" type="submit" class="emoji-button"
>&nbsp;👍&nbsp;</button >&nbsp;👍&nbsp;</button

View File

@ -25,16 +25,17 @@
</ul> </ul>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<div class="flex flex-row gap-2 items-center md:h-20 h-16"> <div
<a href="/" class="no-underline text-inherit" class="flex flex-row gap-2 items-center md:h-20 h-16"
><h1 class="font-mono md:text-6xl text-5xl -ml-[0.27rem]">Log101</h1></a id="title-container">
> <a href="/" class="no-underline text-inherit -ml-[0.27rem]" id="title">
<h1 class="font-mono md:text-6xl text-5xl">Log101</h1>
</a>
<div id="board" class="board"></div> <div id="board" class="board"></div>
</div> </div>
<div> <div>
<ul <ul
class="flex md:flex-row flex-col md:items-center justify-between list-none p-0 gap-3 nav-links" class="flex md:flex-row flex-col md:items-center justify-between list-none p-0 gap-3 nav-links">
>
<li> <li>
<a href="/category/fikir">Fikir</a> <a href="/category/fikir">Fikir</a>
</li> </li>
@ -55,13 +56,19 @@
<script> <script>
import ConwaySimulator from "../scripts/conway-simulator"; import ConwaySimulator from "../scripts/conway-simulator";
let rows = 8; const title = document.getElementById("title");
let cols = 24; const titleContainer = document.getElementById("title-container");
const titleWidth = title?.offsetWidth ?? 194;
const titleContainerWidth = titleContainer?.offsetWidth ?? 750;
let pixelSize = 6; let pixelSize = 6;
let rows = 8;
let cols = (titleContainerWidth - titleWidth) / pixelSize;
let delay = 250; let delay = 250;
if (screen.availWidth > 768) { if (screen.availWidth > 768) {
cols = 46; cols = 60;
pixelSize = 8; pixelSize = 8;
} }

View File

@ -107,8 +107,7 @@ import calendar from "@/images/calendar.svg";
{post.body.length > 500 && ( {post.body.length > 500 && (
<a <a
class="text-inherit text-sm" class="text-inherit text-sm"
href={`/category/${post.data.category}/${post.slug}`} href={`/category/${post.data.category}/${post.slug}`}>
>
Devamını Oku Devamını Oku
</a> </a>
)} )}

View File

@ -21,8 +21,7 @@ import "../styles/main.css";
</head> </head>
<body class="flex justify-center font-sans"> <body class="flex justify-center font-sans">
<div <div
class="md:max-w-[750px] w-full flex flex-col gap-8 md:gap-6 my-6 md:mx-0 mx-4 overflow-hidden" class="md:max-w-[750px] w-full flex flex-col gap-8 md:gap-6 my-6 md:mx-0 mx-4 overflow-hidden">
>
<slot /> <slot />
</div> </div>
</body> </body>

View File

@ -12,7 +12,7 @@ export async function getStaticPaths({ paginate }: { paginate: any }) {
return CATEGORIES.flatMap((category) => { return CATEGORIES.flatMap((category) => {
const filteredPosts = blogEntries.filter( const filteredPosts = blogEntries.filter(
(post) => post.data.category == category (post) => post.data.category == category,
); );
return paginate(filteredPosts, { return paginate(filteredPosts, {
params: { category }, params: { category },
@ -62,8 +62,7 @@ const pages = Array.from({ length: page.lastPage }, (_, i) => i + 1);
return ( return (
<a <a
href={`${page.url.current.slice(0, -1)}${pageNumber}`} href={`${page.url.current.slice(0, -1)}${pageNumber}`}
class="text-inherit" class="text-inherit">
>
{pageNumber} {pageNumber}
</a> </a>
); );

View File

@ -36,8 +36,7 @@ export async function getStaticPaths() {
hx-trigger="load" hx-trigger="load"
hx-swap="innerHTML" hx-swap="innerHTML"
id="comments-container" id="comments-container"
class="flex flex-col gap-6" class="flex flex-col gap-6">
>
<p id="no-comments-text">Henüz yorum yok!</p> <p id="no-comments-text">Henüz yorum yok!</p>
</div> </div>
<HorizontalLine /> <HorizontalLine />

View File

@ -1,3 +1,5 @@
// https://github.com/Tebs-Lab/conways-game-of-life
import { heavyWeightSpaceshipCell } from "./utils"; import { heavyWeightSpaceshipCell } from "./utils";
/* /*

3400
src/scripts/htmx.min.js vendored

File diff suppressed because one or more lines are too long