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