mirror of
https://github.com/hex248/ob248.com.git
synced 2026-02-07 18:23:04 +00:00
more biome fixes
This commit is contained in:
@@ -2,10 +2,6 @@
|
||||
import { Icon } from "astro-icon/components";
|
||||
import type { AstroModule, ProjectMetadata } from "../pages/index.astro";
|
||||
|
||||
type Props = {};
|
||||
|
||||
const {} = Astro.props;
|
||||
|
||||
const options = [{ name: "home", location: "/" }];
|
||||
options.push({
|
||||
name: "GitHub",
|
||||
@@ -62,11 +58,8 @@ Object.values(import.meta.glob<AstroModule>("../pages/projects/*.astro", { eager
|
||||
) {
|
||||
let found = false;
|
||||
for (let j = 0; j < optionElements.length; j++) {
|
||||
const nextIndex =
|
||||
(selectedOptionIndex + j) % optionElements.length;
|
||||
if (
|
||||
!optionElements[nextIndex].classList.contains("hidden")
|
||||
) {
|
||||
const nextIndex = (selectedOptionIndex + j) % optionElements.length;
|
||||
if (!optionElements[nextIndex].classList.contains("hidden")) {
|
||||
selectedOptionIndex = nextIndex;
|
||||
showSelection();
|
||||
found = true;
|
||||
@@ -139,19 +132,14 @@ Object.values(import.meta.glob<AstroModule>("../pages/projects/*.astro", { eager
|
||||
toggleCommandPalette();
|
||||
e.preventDefault();
|
||||
}
|
||||
if (
|
||||
(key === "arrowdown" || key === "arrowup") &&
|
||||
commandPaletteOpen
|
||||
) {
|
||||
if ((key === "arrowdown" || key === "arrowup") && commandPaletteOpen) {
|
||||
const optionElements = document
|
||||
.getElementById("command-palette")
|
||||
?.getElementsByTagName("a");
|
||||
if (optionElements) {
|
||||
const operation = key === "arrowdown" ? 1 : -1;
|
||||
selectedOptionIndex =
|
||||
(selectedOptionIndex +
|
||||
operation +
|
||||
optionElements.length) %
|
||||
(selectedOptionIndex + operation + optionElements.length) %
|
||||
optionElements.length;
|
||||
showSelection();
|
||||
}
|
||||
@@ -163,8 +151,7 @@ Object.values(import.meta.glob<AstroModule>("../pages/projects/*.astro", { eager
|
||||
.getElementById("command-palette")
|
||||
?.getElementsByTagName("a");
|
||||
if (optionElements && optionElements[selectedOptionIndex]) {
|
||||
window.location.href =
|
||||
optionElements[selectedOptionIndex].href;
|
||||
window.location.href = optionElements[selectedOptionIndex].href;
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -196,10 +183,7 @@ Object.values(import.meta.glob<AstroModule>("../pages/projects/*.astro", { eager
|
||||
>
|
||||
<div class="flex text-2xl border-ayu-accent w-full border-b-2">
|
||||
<span class="flex items-center no-select p-4 pr-2 gap-2">
|
||||
<Icon
|
||||
name="mdi:toy-brick-search"
|
||||
class="w-6 h-6"
|
||||
/>search:</span
|
||||
<Icon name="mdi:toy-brick-search" class="w-6 h-6" />search:</span
|
||||
>
|
||||
<input
|
||||
oninput="updateOptions()"
|
||||
|
||||
@@ -50,7 +50,7 @@ function parseDate(dateStr: string): Date {
|
||||
if (lower.includes(monthName)) {
|
||||
const yearMatch = dateStr.match(/\b(20\d{2})\b/);
|
||||
if (yearMatch) {
|
||||
return new Date(parseInt(yearMatch[1]), monthIndex, 1);
|
||||
return new Date(parseInt(yearMatch[1], 10), monthIndex, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ function parseDate(dateStr: string): Date {
|
||||
// fallback: try to extract any year
|
||||
const yearMatch = dateStr.match(/\b(20\d{2})\b/);
|
||||
if (yearMatch) {
|
||||
return new Date(parseInt(yearMatch[1]), 0, 1);
|
||||
return new Date(parseInt(yearMatch[1], 10), 0, 1);
|
||||
}
|
||||
|
||||
return new Date(0);
|
||||
@@ -76,7 +76,9 @@ const projects: ProjectMetadata[] = Object.values(
|
||||
|
||||
const allTags = new Set<string>();
|
||||
projects.forEach((project) => {
|
||||
project.tags?.forEach((tag) => allTags.add(tag));
|
||||
project.tags?.forEach((tag) => {
|
||||
allTags.add(tag);
|
||||
});
|
||||
});
|
||||
|
||||
const sortedTags = Array.from(allTags).sort((a, b) => a.localeCompare(b));
|
||||
|
||||
@@ -301,7 +301,6 @@ body {
|
||||
.no-select {
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-khtml-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-o-user-select: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user