From a2b88e124750d0deb41106be144ef8f14f3af1b2 Mon Sep 17 00:00:00 2001 From: satnaing Date: Tue, 25 Feb 2025 20:20:43 +0700 Subject: [PATCH] refactor!: separate config and constants --- src/config.ts | 142 +---------------------------------------------- src/constants.ts | 80 ++++++++++++++++++++++++++ src/env.d.ts | 2 - src/types.ts | 27 --------- 4 files changed, 83 insertions(+), 168 deletions(-) create mode 100644 src/constants.ts delete mode 100644 src/env.d.ts delete mode 100644 src/types.ts diff --git a/src/config.ts b/src/config.ts index 1f00e67..e7f7298 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,6 +1,4 @@ -import type { Site, SocialObjects } from "./types"; - -export const SITE: Site = { +export const SITE = { website: "https://astro-paper.pages.dev/", // replace this with your deployed domain author: "Sat Naing", profile: "https://satnaing.dev/", @@ -9,147 +7,13 @@ export const SITE: Site = { ogImage: "astropaper-og.jpg", lightAndDarkMode: true, postPerIndex: 4, - postPerPage: 3, + postPerPage: 4, scheduledPostMargin: 15 * 60 * 1000, // 15 minutes showArchives: true, + showBackButton: true, // show back button in post detail editPost: { url: "https://github.com/satnaing/astro-paper/edit/main/src/content/blog", text: "Suggest Changes", appendFilePath: true, }, -}; - -export const LOCALE = { - lang: "en", // html lang code. Set this empty and default will be "en" - langTag: ["en-EN"], // BCP 47 Language Tags. Set this empty [] to use the environment default } as const; - -export const LOGO_IMAGE = { - enable: false, - svg: true, - width: 216, - height: 46, -}; - -export const SOCIALS: SocialObjects = [ - { - name: "Github", - href: "https://github.com/satnaing/astro-paper", - linkTitle: ` ${SITE.title} on Github`, - active: true, - }, - { - name: "Facebook", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Facebook`, - active: true, - }, - { - name: "Instagram", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Instagram`, - active: true, - }, - { - name: "LinkedIn", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on LinkedIn`, - active: true, - }, - { - name: "Mail", - href: "mailto:yourmail@gmail.com", - linkTitle: `Send an email to ${SITE.title}`, - active: false, - }, - { - name: "X", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on X`, - active: false, - }, - { - name: "Twitch", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Twitch`, - active: false, - }, - { - name: "YouTube", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on YouTube`, - active: false, - }, - { - name: "WhatsApp", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on WhatsApp`, - active: false, - }, - { - name: "Snapchat", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Snapchat`, - active: false, - }, - { - name: "Pinterest", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Pinterest`, - active: false, - }, - { - name: "TikTok", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on TikTok`, - active: false, - }, - { - name: "CodePen", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on CodePen`, - active: false, - }, - { - name: "Discord", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Discord`, - active: false, - }, - { - name: "GitLab", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on GitLab`, - active: false, - }, - { - name: "Reddit", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Reddit`, - active: false, - }, - { - name: "Skype", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Skype`, - active: false, - }, - { - name: "Steam", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Steam`, - active: false, - }, - { - name: "Telegram", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Telegram`, - active: false, - }, - { - name: "Mastodon", - href: "https://github.com/satnaing/astro-paper", - linkTitle: `${SITE.title} on Mastodon`, - active: false, - }, -]; diff --git a/src/constants.ts b/src/constants.ts new file mode 100644 index 0000000..beabe9a --- /dev/null +++ b/src/constants.ts @@ -0,0 +1,80 @@ +import IconMail from "@/assets/icons/IconMail.svg"; +import IconGitHub from "@/assets/icons/IconGitHub.svg"; +import IconBrandX from "@/assets/icons/IconBrandX.svg"; +import IconLinkedin from "@/assets/icons/IconLinkedin.svg"; +import IconWhatsapp from "@/assets/icons/IconWhatsapp.svg"; +import IconFacebook from "@/assets/icons/IconFacebook.svg"; +import IconTelegram from "@/assets/icons/IconTelegram.svg"; +import IconPinterest from "@/assets/icons/IconPinterest.svg"; +import { SITE } from "@/config"; + +export const LOCALE = { + lang: "en", // html lang code. Set this empty and default will be "en" + langTag: ["en-EN"], // BCP 47 Language Tags. Set this empty [] to use the environment default +} as const; + +export const SOCIALS = [ + { + name: "Github", + href: "https://github.com/satnaing/astro-paper", + linkTitle: ` ${SITE.title} on Github`, + icon: IconGitHub, + }, + { + name: "X", + href: "https://x.com/username", + linkTitle: `${SITE.title} on X`, + icon: IconBrandX, + }, + { + name: "LinkedIn", + href: "https://www.linkedin.com/in/username/", + linkTitle: `${SITE.title} on LinkedIn`, + icon: IconLinkedin, + }, + { + name: "Mail", + href: "mailto:yourmail@gmail.com", + linkTitle: `Send an email to ${SITE.title}`, + icon: IconMail, + }, +] as const; + +export const SHARE_LINKS = [ + { + name: "WhatsApp", + href: "https://wa.me/?text=", + linkTitle: `Share this post via WhatsApp`, + icon: IconWhatsapp, + }, + { + name: "Facebook", + href: "https://www.facebook.com/sharer.php?u=", + linkTitle: `Share this post on Facebook`, + icon: IconFacebook, + }, + { + name: "X", + href: "https://x.com/intent/post?url=", + linkTitle: `Share this post on X`, + icon: IconBrandX, + }, + { + name: "Telegram", + href: "https://t.me/share/url?url=", + linkTitle: `Share this post via Telegram`, + icon: IconTelegram, + }, + { + name: "Pinterest", + href: "https://pinterest.com/pin/create/button/?url=", + linkTitle: `Share this post on Pinterest`, + icon: IconPinterest, + }, + { + name: "Mail", + href: "mailto:?subject=See%20this%20post&body=", + linkTitle: `Share this post via email`, + icon: IconMail, + }, +] as const; diff --git a/src/env.d.ts b/src/env.d.ts deleted file mode 100644 index acef35f..0000000 --- a/src/env.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -/// diff --git a/src/types.ts b/src/types.ts deleted file mode 100644 index f61effa..0000000 --- a/src/types.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type socialIcons from "@assets/socialIcons"; - -export type Site = { - website: string; - author: string; - profile: string; - desc: string; - title: string; - ogImage?: string; - lightAndDarkMode: boolean; - postPerIndex: number; - postPerPage: number; - scheduledPostMargin: number; - showArchives?: boolean; - editPost?: { - url?: URL["href"]; - text?: string; - appendFilePath?: boolean; - }; -}; - -export type SocialObjects = { - name: keyof typeof socialIcons; - href: string; - active: boolean; - linkTitle: string; -}[];