Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Refine the Contributor Experience #694

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 117 additions & 164 deletions src/icons.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { library } from "@fortawesome/fontawesome-svg-core";
import { faCircleCheck as farCircleCheck, faObjectUngroup } from "@fortawesome/free-regular-svg-icons";
import { IconDefinition, IconPack, IconPrefix, library } from "@fortawesome/fontawesome-svg-core";

import {
faChrome as fabChrome,
faFirefox as fabFirefox,
Expand All @@ -12,166 +12,119 @@ import {
faDiscord as fabDiscord,
faCcPaypal as fabPaypal,
} from "@fortawesome/free-brands-svg-icons";
import {
faSunBright,
faMoon,
faEnvelope,
faCircle,
faBars,
faPlus,
faHexagonPlus,
faMinus,
faStar,
faSlash,
faLock,
faPen,
faFlag,
faCheck,
faChevronsDown,
faChevronRight,
faChevronLeft,
faGavel,
faCopy,
faExclamationTriangle,
faExclamation,
faExternalLinkAlt,
faCalendarAlt,
faPalette,
faCube,
faGear,
faUsersCog,
faEllipsisH,
faEllipsisV,
faColumns,
faTrash,
faTimes,
faSearch,
faReply,
faArrowLeft,
faChevronsRight,
faObjectGroup,
faLayerGroup,
faEye,
faEyeSlash,
faTag,
faLanguage,
faChevronDown,
faUser,
faUserPlus,
faUserMinus,
faSave,
faDownload,
faRotateRight,
faFire,
faHashtag,
faSeal,
faBrush,
faTicket,
faSmile,
faCreditCard,
faCakeSlice,
faClock,
faSquareQuestion,
faTrophy,
faGift,
faUserPen,
faTimer,
faListCheck,
faCodeBranch,
faPenField,
faWrench,
faUnlock,
faUndo,
faFilter,
faSquare,
faPumpkin,
} from "@fortawesome/sharp-solid-svg-icons";

library.add(
faSunBright,
faMoon,
faEnvelope,
fabChrome,
fabFirefox,
fabEdge,
fabOpera,
fabTwitter,
fabGithub,
fabPaypal,
faCircle,
faBars,
faPlus,
faHexagonPlus,
faMinus,
fabTwitch,
fabYoutube,
fabDiscord,
faStar,
faCheck,
farCircleCheck,
faSlash,
faLock,
faUnlock,
faPen,
faFlag,
faSearch,
faChevronsDown,
faChevronRight,
faChevronLeft,
faGavel,
faCopy,
faExclamationTriangle,
faExclamation,
faExternalLinkAlt,
faCalendarAlt,
faPalette,
faCube,
faGear,
faUsersCog,
faEllipsisH,
faEllipsisV,
faColumns,
faTrash,
faTimes,
faSearch,
faReply,
faArrowLeft,
faChevronsRight,
faObjectGroup,
faObjectUngroup,
faLayerGroup,
faEye,
faEyeSlash,
faTag,
faLanguage,
faChevronDown,
faUser,
faUserPlus,
faUserMinus,
faSave,
faDownload,
faRotateRight,
faFire,
faHashtag,
faSeal,
faBrush,
faTicket,
faSmile,
faCreditCard,
faCakeSlice,
faClock,
faSquareQuestion,
faTrophy,
faGift,
faUserPen,
faTimer,
faListCheck,
faCodeBranch,
faPenField,
faWrench,
faCopy,
faUndo,
faFilter,
faSquare,
faPumpkin,
);
type FreeType = keyof typeof import("@fortawesome/free-solid-svg-icons");
const freeIcons = {
faCircleCheck: null,
faObjectUngroup: null,
faMoon: null,
faEnvelope: null,
faCircle: null,
faBars: null,
faPlus: null,
faMinus: null,
faStar: null,
faSlash: null,
faLock: null,
faPen: null,
faFlag: null,
faCheck: null,
faChevronRight: null,
faChevronLeft: null,
faGavel: null,
faCopy: null,
faExclamationTriangle: null,
faExclamation: null,
faExternalLinkAlt: null,
faCalendarAlt: null,
faPalette: null,
faCube: null,
faGear: null,
faUsersCog: null,
faEllipsisH: null,
faEllipsisV: null,
faColumns: null,
faTrash: null,
faTimes: null,
faSearch: null,
faReply: null,
faArrowLeft: null,
faObjectGroup: null,
faLayerGroup: null,
faEye: null,
faEyeSlash: null,
faTag: null,
faLanguage: null,
faChevronDown: null,
faUser: null,
faUserPlus: null,
faUserMinus: null,
faSave: null,
faDownload: null,
faRotateRight: null,
faFire: null,
faHashtag: null,
faBrush: null,
faTicket: null,
faSmile: null,
faCreditCard: null,
faClock: null,
faTrophy: null,
faGift: null,
faUserPen: null,
faListCheck: null,
faCodeBranch: null,
faWrench: null,
faUnlock: null,
faUndo: null,
faFilter: null,
faSquare: null,
} as Record<FreeType, IconDefinition | IconPack | IconPrefix | null | undefined>;

type ProType = keyof typeof import("@fortawesome/sharp-solid-svg-icons");
const proIcons = {
faCakeSlice: null,
faSquareQuestion: null,
faTimer: null,
faPenField: null,
faPumpkin: null,
faSunBright: null,
faHexagonPlus: null,
faChevronsDown: null,
faChevronsRight: null,
faSeal: null,
} as Record<ProType, IconDefinition | IconPack | IconPrefix | null | undefined>;

export const loadIcons = async () => {
const isPro = import.meta.env.VITE_APP_FA_PRO === "true";

const pack = [] as IconDefinition[];
if (isPro) {
await import("@fortawesome/sharp-solid-svg-icons").then((icons) => {
Object.keys({ ...proIcons, ...freeIcons }).forEach((key) => {
pack.push(icons[key] as IconDefinition);
});
});
} else {
await import("@fortawesome/free-solid-svg-icons").then((icons) => {
Object.keys(freeIcons).forEach((key) => {
pack.push(icons[key] as IconDefinition);
});
});
}

const fab = [
fabChrome,
fabFirefox,
fabEdge,
fabOpera,
fabTwitter,
fabGithub,
fabTwitch,
fabYoutube,
fabDiscord,
fabPaypal,
];

library.add(...pack, ...fab);
};
49 changes: 27 additions & 22 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,30 @@ import { createPinia } from "pinia";

import App from "@/App.vue";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";

const app = createApp({
setup() {
provide(DefaultApolloClient, apolloClient);
},
render: () => h(App),
});

formkitConfig;
app.use(createHead())
.use(createPinia())
.use(router)
.use(i18n)
.use(formkit, formkitConfig)
.use(vWave)
.use(RouterPrefetch)
.component("font-awesome-icon", FontAwesomeIcon)
.component("Popper", Popper);

directives(app);

app.mount("#app");
import { loadIcons } from "@/icons";

(async () => {
await loadIcons();

const app = createApp({
setup() {
provide(DefaultApolloClient, apolloClient);
},
render: () => h(App),
});

formkitConfig;
app.use(createHead())
.use(createPinia())
.use(router)
.use(i18n)
.use(formkit, formkitConfig)
.use(vWave)
.use(RouterPrefetch)
.component("font-awesome-icon", FontAwesomeIcon)
.component("Popper", Popper);

directives(app);

app.mount("#app");
})();