forked from jsnbuchanan/crowd-funder-for-time-pwa
refactor: move lib directory to libs for consistency
- Move src/lib/capacitor to src/libs/capacitor - Move src/lib/fontawesome.ts to src/libs/fontawesome.ts - Update import paths in main.capacitor.ts and main.common.ts - Remove empty src/lib directory This change standardizes the project structure by using the 'libs' directory consistently throughout the codebase.
This commit is contained in:
59
src/libs/capacitor/app.ts
Normal file
59
src/libs/capacitor/app.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
// Import from node_modules using relative path
|
||||
|
||||
import {
|
||||
App as CapacitorApp,
|
||||
AppLaunchUrl,
|
||||
BackButtonListener,
|
||||
} from "../../../node_modules/@capacitor/app";
|
||||
import type { PluginListenerHandle } from "@capacitor/core";
|
||||
|
||||
/**
|
||||
* Interface defining the app event listener functionality
|
||||
* Supports 'backButton' and 'appUrlOpen' events from Capacitor
|
||||
*/
|
||||
interface AppInterface {
|
||||
/**
|
||||
* Add listener for back button events
|
||||
* @param eventName - Must be 'backButton'
|
||||
* @param listenerFunc - Callback function for back button events
|
||||
* @returns Promise that resolves with a removable listener handle
|
||||
*/
|
||||
addListener(
|
||||
eventName: "backButton",
|
||||
listenerFunc: BackButtonListener,
|
||||
): Promise<PluginListenerHandle> & PluginListenerHandle;
|
||||
|
||||
/**
|
||||
* Add listener for app URL open events
|
||||
* @param eventName - Must be 'appUrlOpen'
|
||||
* @param listenerFunc - Callback function for URL open events
|
||||
* @returns Promise that resolves with a removable listener handle
|
||||
*/
|
||||
addListener(
|
||||
eventName: "appUrlOpen",
|
||||
listenerFunc: (data: AppLaunchUrl) => void,
|
||||
): Promise<PluginListenerHandle> & PluginListenerHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* App wrapper for Capacitor functionality
|
||||
* Provides type-safe event listeners for back button and URL open events
|
||||
*/
|
||||
export const App: AppInterface = {
|
||||
addListener(
|
||||
eventName: "backButton" | "appUrlOpen",
|
||||
listenerFunc: BackButtonListener | ((data: AppLaunchUrl) => void),
|
||||
): Promise<PluginListenerHandle> & PluginListenerHandle {
|
||||
if (eventName === "backButton") {
|
||||
return CapacitorApp.addListener(
|
||||
eventName,
|
||||
listenerFunc as BackButtonListener,
|
||||
) as Promise<PluginListenerHandle> & PluginListenerHandle;
|
||||
} else {
|
||||
return CapacitorApp.addListener(
|
||||
eventName,
|
||||
listenerFunc as (data: AppLaunchUrl) => void,
|
||||
) as Promise<PluginListenerHandle> & PluginListenerHandle;
|
||||
}
|
||||
},
|
||||
};
|
||||
172
src/libs/fontawesome.ts
Normal file
172
src/libs/fontawesome.ts
Normal file
@@ -0,0 +1,172 @@
|
||||
/**
|
||||
* @file Font Awesome Icon Library Configuration
|
||||
* @description Centralizes Font Awesome icon imports and library configuration
|
||||
* @author Matthew Raymer
|
||||
*/
|
||||
|
||||
import { library } from "@fortawesome/fontawesome-svg-core";
|
||||
import {
|
||||
faArrowDown,
|
||||
faArrowLeft,
|
||||
faArrowRight,
|
||||
faArrowRotateBackward,
|
||||
faArrowUpRightFromSquare,
|
||||
faArrowUp,
|
||||
faBan,
|
||||
faBitcoinSign,
|
||||
faBurst,
|
||||
faCalendar,
|
||||
faCamera,
|
||||
faCameraRotate,
|
||||
faCaretDown,
|
||||
faChair,
|
||||
faCheck,
|
||||
faChevronDown,
|
||||
faChevronLeft,
|
||||
faChevronRight,
|
||||
faChevronUp,
|
||||
faCircle,
|
||||
faCircleCheck,
|
||||
faCircleInfo,
|
||||
faCircleQuestion,
|
||||
faCircleUser,
|
||||
faClock,
|
||||
faCoins,
|
||||
faComment,
|
||||
faCopy,
|
||||
faDollar,
|
||||
faEllipsis,
|
||||
faEllipsisVertical,
|
||||
faEnvelopeOpenText,
|
||||
faEraser,
|
||||
faEye,
|
||||
faEyeSlash,
|
||||
faFileContract,
|
||||
faFileLines,
|
||||
faFilter,
|
||||
faFloppyDisk,
|
||||
faFolderOpen,
|
||||
faForward,
|
||||
faGift,
|
||||
faGlobe,
|
||||
faHammer,
|
||||
faHand,
|
||||
faHandHoldingDollar,
|
||||
faHandHoldingHeart,
|
||||
faHouseChimney,
|
||||
faImage,
|
||||
faImagePortrait,
|
||||
faLeftRight,
|
||||
faLightbulb,
|
||||
faLink,
|
||||
faLocationDot,
|
||||
faLongArrowAltLeft,
|
||||
faLongArrowAltRight,
|
||||
faMagnifyingGlass,
|
||||
faMessage,
|
||||
faMinus,
|
||||
faPen,
|
||||
faPersonCircleCheck,
|
||||
faPersonCircleQuestion,
|
||||
faPlus,
|
||||
faQuestion,
|
||||
faQrcode,
|
||||
faRightFromBracket,
|
||||
faRotate,
|
||||
faShareNodes,
|
||||
faSpinner,
|
||||
faSquare,
|
||||
faSquareCaretDown,
|
||||
faSquareCaretUp,
|
||||
faSquarePlus,
|
||||
faTrashCan,
|
||||
faTriangleExclamation,
|
||||
faUser,
|
||||
faUsers,
|
||||
faXmark,
|
||||
} from "@fortawesome/free-solid-svg-icons";
|
||||
|
||||
// Initialize Font Awesome library with all required icons
|
||||
library.add(
|
||||
faArrowDown,
|
||||
faArrowLeft,
|
||||
faArrowRight,
|
||||
faArrowRotateBackward,
|
||||
faArrowUpRightFromSquare,
|
||||
faArrowUp,
|
||||
faBan,
|
||||
faBitcoinSign,
|
||||
faBurst,
|
||||
faCalendar,
|
||||
faCamera,
|
||||
faCameraRotate,
|
||||
faCaretDown,
|
||||
faChair,
|
||||
faCheck,
|
||||
faChevronDown,
|
||||
faChevronLeft,
|
||||
faChevronRight,
|
||||
faChevronUp,
|
||||
faCircle,
|
||||
faCircleCheck,
|
||||
faCircleInfo,
|
||||
faCircleQuestion,
|
||||
faCircleUser,
|
||||
faClock,
|
||||
faCoins,
|
||||
faComment,
|
||||
faCopy,
|
||||
faDollar,
|
||||
faEllipsis,
|
||||
faEllipsisVertical,
|
||||
faEnvelopeOpenText,
|
||||
faEraser,
|
||||
faEye,
|
||||
faEyeSlash,
|
||||
faFileContract,
|
||||
faFileLines,
|
||||
faFilter,
|
||||
faFloppyDisk,
|
||||
faFolderOpen,
|
||||
faForward,
|
||||
faGift,
|
||||
faGlobe,
|
||||
faHammer,
|
||||
faHand,
|
||||
faHandHoldingDollar,
|
||||
faHandHoldingHeart,
|
||||
faHouseChimney,
|
||||
faImage,
|
||||
faImagePortrait,
|
||||
faLeftRight,
|
||||
faLightbulb,
|
||||
faLink,
|
||||
faLocationDot,
|
||||
faLongArrowAltLeft,
|
||||
faLongArrowAltRight,
|
||||
faMagnifyingGlass,
|
||||
faMessage,
|
||||
faMinus,
|
||||
faPen,
|
||||
faPersonCircleCheck,
|
||||
faPersonCircleQuestion,
|
||||
faPlus,
|
||||
faQrcode,
|
||||
faQuestion,
|
||||
faRotate,
|
||||
faRightFromBracket,
|
||||
faShareNodes,
|
||||
faSpinner,
|
||||
faSquare,
|
||||
faSquareCaretDown,
|
||||
faSquareCaretUp,
|
||||
faSquarePlus,
|
||||
faTrashCan,
|
||||
faTriangleExclamation,
|
||||
faUser,
|
||||
faUsers,
|
||||
faXmark,
|
||||
);
|
||||
|
||||
// Export the FontAwesomeIcon component for use in other files
|
||||
export { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
||||
Reference in New Issue
Block a user