diff --git a/apps/web/package.json b/apps/web/package.json index c6652fb4..a07f2e0c 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -47,6 +47,7 @@ "@vitest/ui": "^3.0.4", "axios": "^1.7.9", "baseui": "15.0.0", + "consola": "^3.4.2", "copy-to-clipboard": "^3.3.3", "date-fns": "^4.1.0", "dayjs": "^1.11.13", diff --git a/apps/web/src/components/ContextMenu/ContextMenu.tsx b/apps/web/src/components/ContextMenu/ContextMenu.tsx index b4542b8a..5d3b3004 100644 --- a/apps/web/src/components/ContextMenu/ContextMenu.tsx +++ b/apps/web/src/components/ContextMenu/ContextMenu.tsx @@ -2,6 +2,7 @@ import { Folder2, MusicNoteBeamed } from "@styled-icons/bootstrap"; import { EllipsisHorizontal } from "@styled-icons/ionicons-sharp"; import { NestedMenus, StatefulMenu } from "baseui/menu"; import { StatefulPopover } from "baseui/popover"; +import consola from "consola"; export type ContextMenuProps = { file: { @@ -65,7 +66,7 @@ function ContextMenu(props: ContextMenuProps) { }, ]} onItemSelect={({ item }) => { - console.log(`Selected item: ${item.label}`); + consola.log(`Selected item: ${item.label}`); close(); }} overrides={{ diff --git a/apps/web/src/components/StickyPlayer/StickyPlayerWithData.tsx b/apps/web/src/components/StickyPlayer/StickyPlayerWithData.tsx index 51f1213b..7c1c874e 100644 --- a/apps/web/src/components/StickyPlayer/StickyPlayerWithData.tsx +++ b/apps/web/src/components/StickyPlayer/StickyPlayerWithData.tsx @@ -8,6 +8,7 @@ import { API_URL } from "../../consts"; import useLike from "../../hooks/useLike"; import useSpotify from "../../hooks/useSpotify"; import StickyPlayer from "./StrickyPlayer"; +import { consola } from "consola"; function StickyPlayerWithData() { const [liked, setLiked] = useState>({}); @@ -330,7 +331,7 @@ function StickyPlayerWithData() { } }; - console.log(">> WebSocket connection opened"); + consola.info(">> WebSocket connection opened"); }; return () => { @@ -340,7 +341,7 @@ function StickyPlayerWithData() { } ws.close(); } - console.log(">> WebSocket connection closed"); + consola.log(">> WebSocket connection closed"); }; }, []); diff --git a/apps/web/src/hooks/useProfile.tsx b/apps/web/src/hooks/useProfile.tsx index 2515c924..f4aeee83 100644 --- a/apps/web/src/hooks/useProfile.tsx +++ b/apps/web/src/hooks/useProfile.tsx @@ -10,6 +10,7 @@ import { } from "../api/profile"; import { profileAtom } from "../atoms/profile"; import { API_URL } from "../consts"; +import consola from "consola"; export const useProfileByDidQuery = (did: string) => useQuery({ @@ -110,7 +111,7 @@ function useProfile(token?: string | null) { (error && localStorage.getItem("token")) ) { if (data === "Unauthorized") { - console.log(">> Unauthorized"); + consola.log(">> Unauthorized"); localStorage.removeItem("token"); } } @@ -125,7 +126,7 @@ function useProfile(token?: string | null) { (error && localStorage.getItem("token")) ) { if (data === "Unauthorized" && localStorage.getItem("token")) { - console.log(">> error", error, ">> data", data); // localStorage.clear(); + consola.log(">> error", error, ">> data", data); // localStorage.clear(); window.location.href = "/"; } return { diff --git a/apps/web/src/layouts/Main.tsx b/apps/web/src/layouts/Main.tsx index c2f9c13c..c1dc68a1 100644 --- a/apps/web/src/layouts/Main.tsx +++ b/apps/web/src/layouts/Main.tsx @@ -17,6 +17,7 @@ import Navbar from "./Navbar"; import Search from "./Search"; import SpotifyLogin from "./SpotifyLogin"; import { IconEye, IconEyeOff, IconLock } from "@tabler/icons-react"; +import { consola } from "consola"; const Container = styled.div` display: flex; @@ -97,7 +98,7 @@ function Main(props: MainProps) { window.location.href = "/"; } } catch (e) { - console.error(e); + consola.error(e); } }; fetchToken(); diff --git a/apps/web/src/lib/metadata.ts b/apps/web/src/lib/metadata.ts index 9c0d9828..98e0fc02 100644 --- a/apps/web/src/lib/metadata.ts +++ b/apps/web/src/lib/metadata.ts @@ -1,3 +1,4 @@ +import consola from "consola"; import init, { extract_audio_metadata } from "../pkg/raichu"; export class Metadata { @@ -11,7 +12,7 @@ export class Metadata { await init(); // Initialize WASM this.metadata = extract_audio_metadata(uint8Array); - console.log(">> Metadata Loaded Successfully"); + consola.log(">> Metadata Loaded Successfully"); } get_metadata() { diff --git a/apps/web/src/lib/player.ts b/apps/web/src/lib/player.ts index a2c780c8..9d99974a 100644 --- a/apps/web/src/lib/player.ts +++ b/apps/web/src/lib/player.ts @@ -1,4 +1,5 @@ import init, { AudioDecoder } from "../pkg/raichu"; +import consola from "consola"; class AudioPlayer { private audioContext: AudioContext | null = null; @@ -33,7 +34,7 @@ class AudioPlayer { } } - console.log(">> Audio Loaded Successfully"); + consola.info(">> Audio Loaded Successfully"); } play(offset = 0) { diff --git a/apps/web/src/pages/dropbox/Dropbox.tsx b/apps/web/src/pages/dropbox/Dropbox.tsx index 23d244ed..3785426f 100644 --- a/apps/web/src/pages/dropbox/Dropbox.tsx +++ b/apps/web/src/pages/dropbox/Dropbox.tsx @@ -11,6 +11,7 @@ import { useFilesQuery } from "../../hooks/useDropbox"; import Main from "../../layouts/Main"; import { File } from "../../types/file"; import { AudioFile, Directory } from "./styles"; +import consola from "consola"; const columnHelper = createColumnHelper(); @@ -22,13 +23,13 @@ const Dropbox = (props: DropboxProps) => { const { data, isLoading } = useFilesQuery(props.fileId); const playFile = async (id: string) => { - console.log(">> Playing file:", id); + consola.log(">> Playing file:", id); /* const { link } = await getTemporaryLink(id); - console.log(">> Playing file:", link); + consola.log(">> Playing file:", link); const m = new Metadata(); await m.load(link); - console.log(">> Metadata:", m.get_metadata()); + consola.log(">> Metadata:", m.get_metadata()); */ }; diff --git a/apps/web/src/pages/home/feed/Feed.tsx b/apps/web/src/pages/home/feed/Feed.tsx index 0ce2fce5..43773895 100644 --- a/apps/web/src/pages/home/feed/Feed.tsx +++ b/apps/web/src/pages/home/feed/Feed.tsx @@ -21,6 +21,7 @@ import { useScrobbleInfiniteQuery, } from "../../../hooks/useFeed"; import FeedGenerators from "./FeedGenerators"; +import { consola } from "consola"; dayjs.extend(relativeTime); @@ -90,7 +91,7 @@ function Feed() { } ws.close(); } - console.log(">> WebSocket connection closed"); + consola.info(">> WebSocket connection closed"); }; }, [queryClient, feedUri]); diff --git a/apps/web/src/pages/profile/library/Library.tsx b/apps/web/src/pages/profile/library/Library.tsx index 04853024..6011ceaa 100644 --- a/apps/web/src/pages/profile/library/Library.tsx +++ b/apps/web/src/pages/profile/library/Library.tsx @@ -7,6 +7,7 @@ import RecentTracks from "../overview/recenttracks"; import TopArtists from "../overview/topartists"; import TopTracks from "../overview/toptracks"; import Albums from "./albums"; +import consola from "consola"; export type LibraryProps = { activeKey?: string; @@ -17,7 +18,7 @@ function Library(props: LibraryProps) { _.get(props, "activeKey", "0"), ); const { tab } = useSearch({ strict: false }); - console.log("tab", tab); + consola.info("tab", tab); useEffect(() => { if (!tab) { diff --git a/bun.lock b/bun.lock index 737372fd..8ee091e8 100644 --- a/bun.lock +++ b/bun.lock @@ -103,7 +103,7 @@ }, "apps/cli": { "name": "@rocksky/cli", - "version": "0.3.0", + "version": "0.3.4", "bin": { "rocksky": "./dist/index.js", }, @@ -227,6 +227,7 @@ "@vitest/ui": "^3.0.4", "axios": "^1.7.9", "baseui": "15.0.0", + "consola": "^3.4.2", "copy-to-clipboard": "^3.3.3", "date-fns": "^4.1.0", "dayjs": "^1.11.13",