diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 9e190778..5dce5893 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -267,6 +267,7 @@ "private": "Private", "friends_only": "Friends only", "privacy": "Privacy", - "blocked_users": "Blocked users" + "blocked_users": "Blocked users", + "unblock": "Unblock" } } diff --git a/src/locales/pt/translation.json b/src/locales/pt/translation.json index 036e2ff0..97c59b47 100644 --- a/src/locales/pt/translation.json +++ b/src/locales/pt/translation.json @@ -267,6 +267,7 @@ "private": "Privado", "friends_only": "Apenas amigos", "public": "Público", - "blocked_users": "Usuários bloqueados" + "blocked_users": "Usuários bloqueados", + "unblock": "Desbloquear" } } diff --git a/src/renderer/src/app.tsx b/src/renderer/src/app.tsx index 8c6f7604..2b9ac187 100644 --- a/src/renderer/src/app.tsx +++ b/src/renderer/src/app.tsx @@ -108,7 +108,7 @@ export function App() { fetchFriendRequests(); } }); - }, [fetchUserDetails, updateUserDetails, dispatch]); + }, [fetchUserDetails, fetchFriendRequests, updateUserDetails, dispatch]); const onSignIn = useCallback(() => { fetchUserDetails().then((response) => { @@ -118,7 +118,13 @@ export function App() { showSuccessToast(t("successfully_signed_in")); } }); - }, [fetchUserDetails, t, showSuccessToast, updateUserDetails]); + }, [ + fetchUserDetails, + fetchFriendRequests, + t, + showSuccessToast, + updateUserDetails, + ]); useEffect(() => { const unsubscribe = window.electron.onGamesRunning((gamesRunning) => { diff --git a/src/renderer/src/hooks/use-user-details.ts b/src/renderer/src/hooks/use-user-details.ts index e33de978..0cf2a381 100644 --- a/src/renderer/src/hooks/use-user-details.ts +++ b/src/renderer/src/hooks/use-user-details.ts @@ -99,7 +99,7 @@ export function useUserDetails() { dispatch(setFriendsModalVisible({ initialTab, userId })); fetchFriendRequests(); }, - [dispatch] + [dispatch, fetchFriendRequests] ); const hideFriendsModal = useCallback(() => { diff --git a/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-item.tsx b/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-item.tsx index 7c34d040..2c283ac1 100644 --- a/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-item.tsx +++ b/src/renderer/src/pages/shared-modals/user-friend-modal/user-friend-item.tsx @@ -12,21 +12,26 @@ export type UserFriendItemProps = { userId: string; profileImageUrl: string | null; displayName: string; - onClickItem: (userId: string) => void; } & ( - | { type: "ACCEPTED"; onClickUndoFriendship: (userId: string) => void } + | { + type: "ACCEPTED"; + onClickUndoFriendship: (userId: string) => void; + onClickItem: (userId: string) => void; + } + | { type: "BLOCKED"; onClickUnblock: (userId: string) => void } | { type: "SENT" | "RECEIVED"; onClickCancelRequest: (userId: string) => void; onClickAcceptRequest: (userId: string) => void; onClickRefuseRequest: (userId: string) => void; + onClickItem: (userId: string) => void; } - | { type: null } + | { type: null; onClickItem: (userId: string) => void } ); export const UserFriendItem = (props: UserFriendItemProps) => { const { t } = useTranslation("user_profile"); - const { userId, profileImageUrl, displayName, type, onClickItem } = props; + const { userId, profileImageUrl, displayName, type } = props; const getRequestDescription = () => { if (type === "ACCEPTED" || type === null) return null; @@ -86,15 +91,69 @@ export const UserFriendItem = (props: UserFriendItemProps) => { ); } + if (type === "BLOCKED") { + return ( + + ); + } + return null; }; + if (type === "BLOCKED") { + return ( +
{displayName}
+