6 Revīzijas 943e876e2a ... e37b0b720c

Autors SHA1 Ziņojums Datums
  Vladislav Atakhanov e37b0b720c feat: index page github link 8 mēneši atpakaļ
  Vladislav Atakhanov f0eec09c41 fix: Unsupported file types found 8 mēneši atpakaļ
  Vladislav Atakhanov 16296e266e feat: projects order in projects.txt 8 mēneši atpakaļ
  Vladislav Atakhanov 5ad6bcc201 refactor 8 mēneši atpakaļ
  Vladislav Atakhanov f40307db75 refactor: TypeScript -> JavaScript 8 mēneši atpakaļ
  Vladislav Atakhanov 5ad7c7ed15 fix: projects sort unknown index 8 mēneši atpakaļ

+ 9 - 22
src/api/projects.ts

@@ -1,21 +1,6 @@
 import type { MarkdownInstance } from "astro"
-import { readFileSync } from "node:fs"
-import { dirname, join } from "node:path"
-import { fileURLToPath } from "node:url"
-
-const __dirname = dirname(fileURLToPath(import.meta.url))
-
-const Projects = `
-univer
-smart-hotels
-inshot24
-finance-telegram-bot
-demonster
-green-karaganda
-reader`
-	.trim()
-	.split("\n")
-	.map((line) => line.trim())
+import ProjectTxt from "@content/projects/_projects.txt?raw"
+import { getId } from "../utils/get-id"
 
 interface Image {
 	src: string
@@ -45,15 +30,17 @@ export type PageProject = MarkdownInstance<
 
 export type Project = BaseProject | PageProject
 
-const getId = ({ file }: MarkdownInstance<any>) =>
-	file.split("/").pop()?.slice(0, -3)
+const projectsOrder = ProjectTxt.trim()
+	.split("\n")
+	.map((line) => line.trim())
+	.filter((line) => line.length > 0)
 
-export const sortProjects = (files: any[]): Project[] => {
-	const result = new Array(files.length)
+export const sortProjects = (files: MarkdownInstance<any>[]): Project[] => {
+	const result = new Array(projectsOrder.length)
 	files.forEach((file) => {
 		const id = getId(file)
 		if (!id) return
-		const index = Projects.indexOf(id)
+		const index = projectsOrder.indexOf(id)
 		if (index < 0) return result.push(file)
 		result[index] = file
 	})

+ 1 - 1
src/assets/icons.svg

@@ -9,7 +9,7 @@
 	</symbol>
 
 	<symbol id="github" fill="none" viewBox="0 0 16 16">
-		<path fill="#6e5494"
+		<path fill="#8460bf"
 			d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"></path>
 	</symbol>
 

+ 7 - 0
src/content/projects/_projects.txt

@@ -0,0 +1,7 @@
+univer
+smart-hotels
+inshot24
+finance-telegram-bot
+demonster
+green-karaganda
+reader

+ 2 - 5
src/lib/FormatHTML.astro

@@ -32,11 +32,8 @@ const formatLink = (a: HTMLElement) => {
 const formatHTML = (html: string) => {
     const document = createDocument(html)
     document.querySelectorAll("a").forEach((a) => {
-        if (
-            formatLink(a, document) &&
-            a.parentNode.tagName.toLowerCase() == "li"
-        )
-            a.parentNode.classList.add("li--icon")
+        if (formatLink(a) && a?.parentElement?.tagName?.toLowerCase() == "li")
+            a.parentElement.classList.add("li--icon")
     })
 
     document.querySelectorAll("hr").forEach((hr) => hr.remove())

+ 12 - 8
src/pages/index.astro

@@ -17,21 +17,26 @@ import Icon from "../lib/Icon.astro"
         <h1 class="title">eloh1m</h1>
         <div class="links">
             <a
-                href="https://notabug.org/vladislav-atakhanov"
-                title="Мой аккаунт NotABug"
-                class="link link--notabug"
-                style="--color: #000"
+                href="https://github.com/vladislav-atakhanov"
+                title="Мой аккаунт Github"
+                class="link link--github"
             >
-                <Icon name="notabug" />
+                <Icon name="github" />
             </a>
             <a
                 href="https://t.me/eloh1m"
                 title="Написать мне в Telegram"
                 class="link link--telegram"
-                style="--color: hsl(200, 80%, 50%)"
             >
                 <Icon name="telegram" />
             </a>
+            <a
+                href="https://notabug.org/vladislav-atakhanov"
+                title="Мой аккаунт NotABug"
+                class="link link--notabug"
+            >
+                <Icon name="notabug" />
+            </a>
         </div>
         <a href="mailto:eloh1mZee@gmail.com" class="email" target="_blank"
             >email: <u>eloh1mZee@gmail.com</u></a
@@ -70,7 +75,7 @@ import Icon from "../lib/Icon.astro"
     }
     .links {
         display: flex;
-        gap: 3em;
+        gap: clamp(1.5em, 5vw, 3em);
     }
     h1 {
         font-size: 4em;
@@ -82,7 +87,6 @@ import Icon from "../lib/Icon.astro"
         height: 5em;
         transition: 0.3s ease;
         &:hover {
-            color: var(--color);
             transform: scale(1.1);
         }
         :global(svg) {

+ 1 - 3
src/pages/project/[id].astro

@@ -1,9 +1,9 @@
 ---
-import type { MarkdownInstance } from "astro"
 import FormatHTML from "../../lib/FormatHTML.astro"
 import Icon from "../../lib/Icon.astro"
 import Footer from "../../components/Footer.astro"
 import Header from "../../components/Header.astro"
+import { getId } from "../../utils/get-id"
 
 import Layout from "../../layouts/Layout.astro"
 import {
@@ -13,8 +13,6 @@ import {
 } from "../../api/projects"
 
 export async function getStaticPaths() {
-    const getId = ({ file }: MarkdownInstance<any>) =>
-        file.split("/").pop()?.slice(0, -3)
     const allProjects: PageProject[] = await Astro.glob(
         "../../content/projects/*.md",
     )

+ 0 - 0
src/utils/draft.ts


+ 2 - 1
src/utils/get-date.ts

@@ -1,4 +1,5 @@
-export const getDate = (date: string) => {
+/** @param {string} date */
+export const getDate = (date) => {
 	const [month, year] = date.split("-").map((n) => parseInt(n, 10))
 	return new Date(year, month - 1, 1)
 }

+ 2 - 0
src/utils/get-id.js

@@ -0,0 +1,2 @@
+/** @param {import("astro").MarkdownInstance} markdownInstance */
+export const getId = ({ file }) => file.split("/").pop()?.slice(0, -3)

+ 0 - 0
src/utils/icons.ts


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels