Changeset 890e036 for frontend


Ignore:
Timestamp:
02/09/26 21:45:41 (5 months ago)
Author:
Filip Gavrilovski <filipgavrilovski28@…>
Branches:
main
Children:
0808ef2
Parents:
03a8d87 (diff), 27660af (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'main' into gavro/features

Location:
frontend/src
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • frontend/src/App.tsx

    r03a8d87 r890e036  
    1717import Login from "./pages/Login";
    1818import MusicalCollection from "./pages/MusicalCollection";
     19import MySongs from "./pages/MySongs";
    1920import Nav from "./pages/Nav";
     21import PublishSong from "./pages/PublishSong";
    2022import Register from "./pages/Register";
    2123import SongDetail from "./pages/SongDetail";
     
    2830        // show sidebar only if user is logged in and is on the landing page
    2931        const isLandingPage = location.pathname === "/";
    30         const [isSidebarOpen, setIsSidebarOpen] = useState(!!user && isLandingPage);
     32        const [isSidebarOpen, setIsSidebarOpen] = useState(
     33                !!user && isLandingPage && !user?.isArtist && !user?.isAdmin,
     34        );
    3135
    3236        // Open sidebar when user logs in and navigates to landing page
    3337        useEffect(() => {
    34                 if (user && isLandingPage) {
     38                if (user && isLandingPage && !user.isArtist && !user.isAdmin) {
    3539                        setIsSidebarOpen(true);
    3640                }
     
    104108                        },
    105109                        {
     110                                path: "/my-songs",
     111                                element: <MySongs />,
     112                        },
     113                        {
     114                                path: "/publish",
     115                                element: <PublishSong />,
     116                        },
     117                        {
    106118                                path: "/songs/:id",
    107119                                element: <SongDetail />,
  • frontend/src/pages/Nav.tsx

    r03a8d87 r890e036  
    2222                        setUser(undefined);
    2323                        setIsDropdownOpen(false);
    24                         toast.success("Logout successful!");
     24                        window.location.href = "/";
     25                        // toast.success("Logout successful!");
    2526                } catch (error) {
    2627                        console.error("Logout failed:", error);
     
    8182                                {!isAuthLoading && (
    8283                                        <div className="flex items-center space-x-3">
     84                                                {user?.isArtist && (
     85                                                        <Link
     86                                                                to="/my-songs"
     87                                                                className="text-white hover:text-[#1db954] px-4 py-2 text-sm font-medium transition-colors"
     88                                                        >
     89                                                                My Songs
     90                                                        </Link>
     91                                                )}
    8392                                                {user ? (
    8493                                                        <div className="relative" ref={dropdownRef}>
  • frontend/src/utils/types.ts

    r03a8d87 r890e036  
    44        email?: string;
    55        profilePhoto?: string | null;
    6         role?: "ADMIN" | "NONADMIN";
     6        isAdmin: boolean;
     7        isArtist: boolean;
    78}
    89
     
    107108        songCount: number;
    108109}
     110
     111export interface CatalogItem {
     112        id: number;
     113        title: string;
     114        genre: string;
     115        cover: string | null;
     116        type: "SONG" | "ALBUM";
     117        releaseDate: string;
     118}
     119
     120export interface Contributor {
     121        username: string;
     122        fullName: string;
     123        role: string;
     124}
     125
     126export interface ArtistSearchResult {
     127        username: string;
     128        fullName: string;
     129        profilePhoto?: string;
     130}
     131
     132export interface SongEntry {
     133        title: string;
     134        link: string;
     135        contributors: Contributor[];
     136}
Note: See TracChangeset for help on using the changeset viewer.