diff --git a/src/commands/about.ts b/src/commands/about.ts new file mode 100644 index 0000000..d1f6969 --- /dev/null +++ b/src/commands/about.ts @@ -0,0 +1,80 @@ +import commandJson from "../../config.json" assert { type: "json" }; + +interface Social { + email: string; + git: string; + linkedin: string; + youtube: string; + "pgp-key": string; +} + +interface Command { + aboutGreeting: string; + social: Social; +} + +const command: Command = commandJson; + +interface AboutItem { + label: string; + icon: string; + url: string; + display: string; +} + +const createAbout = (): string[] => { + const about: string[] = []; + + about.push("
"); + about.push(command.aboutGreeting); + about.push("
"); + + const items: AboutItem[] = [ + { + label: "Email", + icon: ``, + url: `mailto:${command.social.email}`, + display: command.social.email, + }, + { + label: "Git", + icon: ``, + url: `https://src.panahifar.ir/${command.social.git}`, + display: `nagini/${command.social.git}`, + }, + { + label: "Linkedin", + icon: ``, + url: `https://www.linkedin.com/in/${command.social.linkedin}`, + display: `linkedin/${command.social.linkedin}`, + }, + { + label: "YouTube", + icon: ``, + url: `https://www.youtube.com/@${command.social.youtube}`, + display: `youtube/${command.social.youtube}`, + }, + { + label: "PGP Key", + icon: ``, + url: `https://src.panahifar.ir/pgp/C86437BFC43196C6.asc`, + display: `key/0xC86437BFC43196C6`, + }, + ]; + + const formatLine = ({ label, icon, url, display }: AboutItem) => { + return ` +
+ ${icon} ${label} + ${display} +
+ `; + }; + + items.forEach((item) => about.push(formatLine(item))); + about.push("
"); + + return about; +}; + +export const ABOUT = createAbout();