feat: files and components

This commit is contained in:
Zamitto 2024-06-15 20:31:26 -03:00
parent 76259c2b54
commit 3ac06fbce5
6 changed files with 13 additions and 13 deletions

View file

@ -11,7 +11,7 @@ export function SidebarProfile() {
const [isUserProfileLoading, setIsUserProfileLoading] = useState(true); const [isUserProfileLoading, setIsUserProfileLoading] = useState(true);
const handleClickProfile = () => { const handleClickProfile = () => {
navigate(`/profile/${userProfile!.id}`); navigate(`/user/${userProfile!.id}`);
}; };
const handleClickLogin = () => { const handleClickLogin = () => {

View file

@ -27,7 +27,7 @@ import {
import { store } from "./store"; import { store } from "./store";
import * as resources from "@locales"; import * as resources from "@locales";
import { Profile } from "./pages/profile/profile"; import { User } from "./pages/user/user";
i18n i18n
.use(LanguageDetector) .use(LanguageDetector)
@ -55,7 +55,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<Route path="/game/:shop/:objectID" Component={GameDetails} /> <Route path="/game/:shop/:objectID" Component={GameDetails} />
<Route path="/search" Component={SearchResults} /> <Route path="/search" Component={SearchResults} />
<Route path="/settings" Component={Settings} /> <Route path="/settings" Component={Settings} />
<Route path="profile/:username" Component={Profile} /> <Route path="/user/:username" Component={User} />
</Route> </Route>
</Routes> </Routes>
</HashRouter> </HashRouter>

View file

@ -1,6 +1,6 @@
import { ProfileGame, UserProfile } from "@types"; import { ProfileGame, UserProfile } from "@types";
import cn from "classnames"; import cn from "classnames";
import * as styles from "./profile.css"; import * as styles from "./user.css";
import { SPACING_UNIT, vars } from "@renderer/theme.css"; import { SPACING_UNIT, vars } from "@renderer/theme.css";
import { useMemo } from "react"; import { useMemo } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -16,7 +16,7 @@ export interface ProfileContentProps {
userProfile: UserProfile; userProfile: UserProfile;
} }
export const ProfileContent = ({ userProfile }: ProfileContentProps) => { export const UserContent = ({ userProfile }: ProfileContentProps) => {
const { t, i18n } = useTranslation("user_profile"); const { t, i18n } = useTranslation("user_profile");
const navigate = useNavigate(); const navigate = useNavigate();

View file

@ -1,7 +1,7 @@
import Skeleton from "react-loading-skeleton"; import Skeleton from "react-loading-skeleton";
import * as styles from "./profile.css"; import * as styles from "./user.css";
export const ProfileSkeleton = () => { export const UserSkeleton = () => {
return ( return (
<> <>
<Skeleton className={styles.profileHeaderSkeleton} /> <Skeleton className={styles.profileHeaderSkeleton} />

View file

@ -3,13 +3,13 @@ import { useEffect, useState } from "react";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { setHeaderTitle } from "@renderer/features"; import { setHeaderTitle } from "@renderer/features";
import { useAppDispatch } from "@renderer/hooks"; import { useAppDispatch } from "@renderer/hooks";
import { ProfileSkeleton } from "./profile-skeleton"; import { UserSkeleton } from "./user-skeleton";
import { ProfileContent } from "./profile-content"; import { UserContent } from "./user-content";
import { SkeletonTheme } from "react-loading-skeleton"; import { SkeletonTheme } from "react-loading-skeleton";
import { vars } from "@renderer/theme.css"; import { vars } from "@renderer/theme.css";
import * as styles from "./profile.css"; import * as styles from "./user.css";
export const Profile = () => { export const User = () => {
const { username } = useParams(); const { username } = useParams();
const [userProfile, setUserProfile] = useState<UserProfile>(); const [userProfile, setUserProfile] = useState<UserProfile>();
@ -28,9 +28,9 @@ export const Profile = () => {
<SkeletonTheme baseColor={vars.color.background} highlightColor="#444"> <SkeletonTheme baseColor={vars.color.background} highlightColor="#444">
<div className={styles.wrapper}> <div className={styles.wrapper}>
{userProfile ? ( {userProfile ? (
<ProfileContent userProfile={userProfile} /> <UserContent userProfile={userProfile} />
) : ( ) : (
<ProfileSkeleton /> <UserSkeleton />
)} )}
</div> </div>
</SkeletonTheme> </SkeletonTheme>