From 69c928452b986f5b16f6dc610f0faa20cb50fe43 Mon Sep 17 00:00:00 2001 From: danielmeschiari Date: Tue, 24 Nov 2026 14:21:34 -0300 Subject: [PATCH 01/17] =?UTF-8?q?refactor:=20refatora=C3=A7=C3=A3o=20da=20?= =?UTF-8?q?fun=C3=A7=C3=A3o=20convert=5Fcursors=5Fto=5Fpaths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/utils/pagination.py | 38 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/backend/src/utils/pagination.py b/backend/src/utils/pagination.py index 393cba1..f1c7a10 100644 --- a/backend/src/utils/pagination.py +++ b/backend/src/utils/pagination.py @@ -4,6 +4,7 @@ import json from pydantic import BaseModel from fastapi import Query +from urllib.parse import parse_qsl, urlencode, urlparse, urlunparse from .utils import escape_like, is_isoformat, op_to_dir, col_name @@ -82,29 +83,30 @@ def build_where(page_clauses: PageClauses, param_queries: PageQuery, count: bool return where, order_by, cols_for_cursor, params -def convert_cursors_to_paths(page_result: PageResult, current_path: str): - """Converte os cursores do page_result de encoded strs para paths de rota""" +def convert_cursors_to_urls(page_result: PageResult, current_url: str): + """Converte os cursores do page_result de encoded strs para urls completas""" - start_index = current_path.find("cursor=") + next_url = None - # Primeira busca (cursor não existe, então só colocar no final) - if start_index == -1: - query_char = "&" if "?" in current_path else "?" - next_path = current_path + query_char + "cursor=" + page_result.next_url if page_result.next_url is not None else None + if page_result.next_url is not None: + # Faz parsing da URL + parsed_url = urlparse(current_url) - # Outra busca (cursor veio de uma busca passada) - else: - start_index += len("cursor=") + # Preserva os demais parâmetros, remove o cursor + query_params = [ + (key, value) + for key, value in parse_qsl(parsed_url.query, keep_blank_values=True) + if key != "cursor" + ] - # Acha o que tiver depois do query parameter "cursor" - end_index = current_path[start_index:].find("&") + # Adiciona o novo cursor + query_params.append(("cursor", page_result.next_url)) - start_of_path = current_path[:start_index] - end_of_path = current_path[start_index + end_index:] if end_index != -1 else "" + # Faz unparsing da URL com o novo cursor + next_url = urlunparse(parsed_url._replace(query=urlencode(query_params))) - next_path = start_of_path + page_result.next_url + end_of_path if page_result.next_url is not None else None - - page_result.current_url = current_path - page_result.next_url = next_path + # Atualiza a url + page_result.current_url = current_url + page_result.next_url = next_url return page_result \ No newline at end of file From b9e72f24c799ce979d2c1ab23b959b7f335c0f35 Mon Sep 17 00:00:00 2001 From: danielmeschiari Date: Sat, 28 Nov 2026 14:18:39 -0300 Subject: [PATCH 02/17] =?UTF-8?q?refactor:=20corre=C3=A7=C3=B5es=20da=20re?= =?UTF-8?q?fatora=C3=A7=C3=A3o=20da=20fun=C3=A7=C3=A3o=20convert=5Fcursors?= =?UTF-8?q?=5Fto=5Fpaths?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/routes/list.py | 6 +++--- backend/src/routes/review.py | 6 +++--- backend/src/routes/user.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/backend/src/routes/list.py b/backend/src/routes/list.py index 7e496af..6a2fc7d 100644 --- a/backend/src/routes/list.py +++ b/backend/src/routes/list.py @@ -82,7 +82,7 @@ async def view_created_lists(user_id: str = Depends(dep.user_id_exists), page_qu has_saved = await DB_read_user_has_saved_list(conn, cl.list_id, user_id_viewer) cl.rel = RelationshipStatus.SAVED if has_saved else RelationshipStatus.ANY - created_lists_page_with_urls = pag.convert_cursors_to_paths(created_lists_page, path) + created_lists_page_with_urls = pag.convert_cursors_to_urls(created_lists_page, path) return JSONResponse(created_lists_page_with_urls.model_dump()) @@ -129,7 +129,7 @@ async def view_saved_lists(page_query = Depends(dep.validate_queries(["name", "c """Busca as listas salvas pelo usuário autenticado""" saved_lists_page = await DB_read_user_saved_lists(conn, user_id, page_query) - saved_lists_page_with_urls = pag.convert_cursors_to_paths(saved_lists_page, path) + saved_lists_page_with_urls = pag.convert_cursors_to_urls(saved_lists_page, path) return JSONResponse(saved_lists_page_with_urls.model_dump()) @@ -178,7 +178,7 @@ async def view_list_games(list_id: str, page_query = Depends(dep.validate_querie await resolve_list_clearence(conn, list_id, user_id, list_creator_id) list_games_page = await DB_read_list_games(conn, list_id, page_query) - list_games_page_with_urls = pag.convert_cursors_to_paths(list_games_page, path) + list_games_page_with_urls = pag.convert_cursors_to_urls(list_games_page, path) return JSONResponse(list_games_page_with_urls.model_dump()) diff --git a/backend/src/routes/review.py b/backend/src/routes/review.py index 2362471..fbaa54c 100644 --- a/backend/src/routes/review.py +++ b/backend/src/routes/review.py @@ -108,7 +108,7 @@ async def get_reviews(user_id: str = Depends(dep.user_id_exists), page_query = D if cr.creator.user_id == user_id_viewer: cr.rel += RelationshipStatus.OWNER - created_reviews_page_with_urls = pag.convert_cursors_to_paths(created_reviews_page, path) + created_reviews_page_with_urls = pag.convert_cursors_to_urls(created_reviews_page, path) return JSONResponse(created_reviews_page_with_urls.model_dump()) @@ -179,7 +179,7 @@ async def get_review_likes(review_id: str, page_query = Depends(dep.validate_que await resolve_review_clearence(conn, review_id, user_id, review_creator_id) review_likes_page = await DB_read_review_likers(conn, review_id, page_query) - review_likes_page_with_urls = pag.convert_cursors_to_paths(review_likes_page, path) + review_likes_page_with_urls = pag.convert_cursors_to_urls(review_likes_page, path) return JSONResponse(review_likes_page_with_urls.model_dump()) @@ -190,6 +190,6 @@ async def get_review_likes(page_query = Depends(dep.validate_queries(["title", " """Retorna as reviews para qual o usuário já deu like""" user_review_likes_page = await DB_read_user_likes(conn, user_id, page_query) - user_review_likes_page_with_urls = pag.convert_cursors_to_paths(user_review_likes_page, path) + user_review_likes_page_with_urls = pag.convert_cursors_to_urls(user_review_likes_page, path) return JSONResponse(user_review_likes_page_with_urls.model_dump()) \ No newline at end of file diff --git a/backend/src/routes/user.py b/backend/src/routes/user.py index 8ece599..3668740 100644 --- a/backend/src/routes/user.py +++ b/backend/src/routes/user.py @@ -151,7 +151,7 @@ async def view_followers(user_id: str = Depends(dep.user_id_exists), user_id_vie resolve_user_clearence(prev_relationship, uncleared_relationships) followers_page = await DB_read_user_followers(conn, user_id, page_query) - followers_page_with_urls = pag.convert_cursors_to_paths(followers_page, url) + followers_page_with_urls = pag.convert_cursors_to_urls(followers_page, url) return JSONResponse(followers_page_with_urls.model_dump()) @@ -171,7 +171,7 @@ async def view_followeds(user_id: str = Depends(dep.user_id_exists), user_id_vie resolve_user_clearence(prev_relationship, uncleared_relationships) followings_page = await DB_read_user_followings(conn, user_id, page_query) - followings_page_with_urls = pag.convert_cursors_to_paths(followings_page, url) + followings_page_with_urls = pag.convert_cursors_to_urls(followings_page, url) return JSONResponse(followings_page_with_urls.model_dump()) @@ -214,7 +214,7 @@ async def view_blocks(page_query = Depends(dep.validate_queries(["username", "cr """Busca os usuários bloqueados pelo usuário autenticado""" blockeds_page = await DB_read_user_blockeds(conn, user_id, page_query) - blockeds_page_with_url = pag.convert_cursors_to_paths(blockeds_page, url) + blockeds_page_with_url = pag.convert_cursors_to_urls(blockeds_page, url) return JSONResponse(blockeds_page_with_url.model_dump()) From cc1f41df19d6b2ed18001c25f988c210d21299bc Mon Sep 17 00:00:00 2001 From: danielmeschiari Date: Sat, 28 Nov 2026 14:25:21 -0300 Subject: [PATCH 03/17] =?UTF-8?q?refactor:=20troca=20dos=20nomes=20de=20pa?= =?UTF-8?q?th=20para=20url=20nas=20fun=C3=A7=C3=B5es=20de=20rotas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/routes/list.py | 12 ++++++------ backend/src/routes/review.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/backend/src/routes/list.py b/backend/src/routes/list.py index 6a2fc7d..97dc586 100644 --- a/backend/src/routes/list.py +++ b/backend/src/routes/list.py @@ -67,7 +67,7 @@ async def edit_list(new_list: ListEdit, list_id: str = Depends(dep.list_is_owned @list_router.get("/created/{user_id}") async def view_created_lists(user_id: str = Depends(dep.user_id_exists), page_query = Depends(dep.validate_queries(["name", "created_at", "updated_at"], "!updated_at")), - conn = Depends(dep.get_conn), user_id_viewer = Depends(dep.optional_login), path = Depends(dep.get_current_url)): + conn = Depends(dep.get_conn), user_id_viewer = Depends(dep.optional_login), url = Depends(dep.get_current_url)): """Busca as listas criadas pelo usuário""" # Verifica qual a relação do usuário visualizador com o usuário criador das listas @@ -82,7 +82,7 @@ async def view_created_lists(user_id: str = Depends(dep.user_id_exists), page_qu has_saved = await DB_read_user_has_saved_list(conn, cl.list_id, user_id_viewer) cl.rel = RelationshipStatus.SAVED if has_saved else RelationshipStatus.ANY - created_lists_page_with_urls = pag.convert_cursors_to_urls(created_lists_page, path) + created_lists_page_with_urls = pag.convert_cursors_to_urls(created_lists_page, url) return JSONResponse(created_lists_page_with_urls.model_dump()) @@ -125,11 +125,11 @@ async def unsave_list(list_id: str, conn = Depends(dep.get_conn), user_id = Depe @list_router.get("/save") async def view_saved_lists(page_query = Depends(dep.validate_queries(["name", "created_at"], "!created_at")), - conn = Depends(dep.get_conn), user_id = Depends(dep.require_login), path = Depends(dep.get_current_url)): + conn = Depends(dep.get_conn), user_id = Depends(dep.require_login), url = Depends(dep.get_current_url)): """Busca as listas salvas pelo usuário autenticado""" saved_lists_page = await DB_read_user_saved_lists(conn, user_id, page_query) - saved_lists_page_with_urls = pag.convert_cursors_to_urls(saved_lists_page, path) + saved_lists_page_with_urls = pag.convert_cursors_to_urls(saved_lists_page, url) return JSONResponse(saved_lists_page_with_urls.model_dump()) @@ -167,7 +167,7 @@ async def rem_from_list(list_id: str = Depends(dep.list_is_owned_by_auth), game_ @list_router.get("/game/{list_id}") async def view_list_games(list_id: str, page_query = Depends(dep.validate_queries(["name", "created_at"], "created_at")), - conn = Depends(dep.get_conn), user_id = Depends(dep.optional_login), path = Depends(dep.get_current_url)): + conn = Depends(dep.get_conn), user_id = Depends(dep.optional_login), url = Depends(dep.get_current_url)): """Busca os games que pertencem a uma lista do usuário""" list_creator_id = await DB_read_list_creator(conn, list_id) @@ -178,7 +178,7 @@ async def view_list_games(list_id: str, page_query = Depends(dep.validate_querie await resolve_list_clearence(conn, list_id, user_id, list_creator_id) list_games_page = await DB_read_list_games(conn, list_id, page_query) - list_games_page_with_urls = pag.convert_cursors_to_urls(list_games_page, path) + list_games_page_with_urls = pag.convert_cursors_to_urls(list_games_page, url) return JSONResponse(list_games_page_with_urls.model_dump()) diff --git a/backend/src/routes/review.py b/backend/src/routes/review.py index fbaa54c..8e1284e 100644 --- a/backend/src/routes/review.py +++ b/backend/src/routes/review.py @@ -93,7 +93,7 @@ async def delete_review(review_id: str = Depends(dep.review_is_owned_by_auth), @review_router.get("/created/{user_id}") async def get_reviews(user_id: str = Depends(dep.user_id_exists), page_query = Depends(dep.validate_queries(["title", "created_at", "updated_at"], "created_at")), - conn = Depends(dep.get_conn), user_id_viewer = Depends(dep.optional_login), path = Depends(dep.get_current_url)): + conn = Depends(dep.get_conn), user_id_viewer = Depends(dep.optional_login), url = Depends(dep.get_current_url)): """Retorna uma página com as mais recente reviews de um usuário""" # Verifica qual a relação do usuário visualizador com o usuário criador das reviews @@ -108,7 +108,7 @@ async def get_reviews(user_id: str = Depends(dep.user_id_exists), page_query = D if cr.creator.user_id == user_id_viewer: cr.rel += RelationshipStatus.OWNER - created_reviews_page_with_urls = pag.convert_cursors_to_urls(created_reviews_page, path) + created_reviews_page_with_urls = pag.convert_cursors_to_urls(created_reviews_page, url) return JSONResponse(created_reviews_page_with_urls.model_dump()) @@ -167,7 +167,7 @@ async def unlike_review(review_id: str, conn = Depends(dep.get_conn), user_id = @review_router.get("/like/users/{review_id}") async def get_review_likes(review_id: str, page_query = Depends(dep.validate_queries(["username", "created_at"], "created_at")), - conn = Depends(dep.get_conn), user_id = Depends(dep.optional_login), path = Depends(dep.get_current_url)): + conn = Depends(dep.get_conn), user_id = Depends(dep.optional_login), url = Depends(dep.get_current_url)): """Retorna quem tem dado like na review""" review_creator_id = await DB_read_review_creator(conn, review_id) @@ -179,17 +179,17 @@ async def get_review_likes(review_id: str, page_query = Depends(dep.validate_que await resolve_review_clearence(conn, review_id, user_id, review_creator_id) review_likes_page = await DB_read_review_likers(conn, review_id, page_query) - review_likes_page_with_urls = pag.convert_cursors_to_urls(review_likes_page, path) + review_likes_page_with_urls = pag.convert_cursors_to_urls(review_likes_page, url) return JSONResponse(review_likes_page_with_urls.model_dump()) @review_router.get("/like/reviews") async def get_review_likes(page_query = Depends(dep.validate_queries(["title", "created_at", "updated_at"], "created_at")), - conn = Depends(dep.get_conn), user_id = Depends(dep.require_login), path = Depends(dep.get_current_url)): + conn = Depends(dep.get_conn), user_id = Depends(dep.require_login), url = Depends(dep.get_current_url)): """Retorna as reviews para qual o usuário já deu like""" user_review_likes_page = await DB_read_user_likes(conn, user_id, page_query) - user_review_likes_page_with_urls = pag.convert_cursors_to_urls(user_review_likes_page, path) + user_review_likes_page_with_urls = pag.convert_cursors_to_urls(user_review_likes_page, url) return JSONResponse(user_review_likes_page_with_urls.model_dump()) \ No newline at end of file From 1a08945e6dbfd4f0ec81a5bb35b35f3a8bdd883d Mon Sep 17 00:00:00 2001 From: joaopneves1570 Date: Sun, 29 Nov 2026 18:40:21 -0300 Subject: [PATCH 04/17] correcoes pra producao --- frontend/index.html | 2 +- frontend/public/nota.svg | 3 +++ frontend/src/data/profilePresets.js | 18 +++++++++------- frontend/src/main.jsx | 2 +- frontend/src/pages/login/index.jsx | 2 +- frontend/src/pages/members/index.jsx | 2 +- .../profile/Sections/EditProfileModal.jsx | 12 +++++------ .../pages/profile/Sections/ProfileHeader.jsx | 2 +- .../pages/profile/Sections/ProfileNavBar.jsx | 2 +- frontend/src/pages/register/index.jsx | 2 +- frontend/src/utils/profileImages.js | 21 +++++++++++++++++++ frontend/vite.config.js | 8 +++++-- 12 files changed, 54 insertions(+), 22 deletions(-) create mode 100644 frontend/public/nota.svg create mode 100644 frontend/src/utils/profileImages.js diff --git a/frontend/index.html b/frontend/index.html index e16ed92..6d02518 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,7 +2,7 @@ - + Gamerboxd diff --git a/frontend/public/nota.svg b/frontend/public/nota.svg new file mode 100644 index 0000000..8e178bc --- /dev/null +++ b/frontend/public/nota.svg @@ -0,0 +1,3 @@ + + + diff --git a/frontend/src/data/profilePresets.js b/frontend/src/data/profilePresets.js index 461db09..86c1bfa 100644 --- a/frontend/src/data/profilePresets.js +++ b/frontend/src/data/profilePresets.js @@ -1,19 +1,23 @@ +import { getAvatarUrl, getBannerUrl } from "../utils/profileImages"; + export const avatarOptions = Array.from({ length: 14 }, (_, index) => { const numero = index + 1; + const id = `avatar${numero}`; return { - id: `avatar-${numero}`, - url: `/presets/avatares/avatar${numero}.png`, - name: `Avatar ${numero}` + id, + url: getAvatarUrl(id), + name: `Avatar ${numero}`, }; }); export const bannerOptions = Array.from({ length: 16 }, (_, index) => { const numero = index + 1; + const id = `banner${numero}`; return { - id: `banner-${numero}`, - url: `/presets/banners/banner${numero}.png`, - name: `Banner ${numero}` + id, + url: getBannerUrl(id), + name: `Banner ${numero}`, }; -}); \ No newline at end of file +}); diff --git a/frontend/src/main.jsx b/frontend/src/main.jsx index 3ab3274..8a9fb04 100644 --- a/frontend/src/main.jsx +++ b/frontend/src/main.jsx @@ -24,7 +24,7 @@ const queryClient = new QueryClient({ createRoot(document.getElementById("root")).render( - + diff --git a/frontend/src/pages/login/index.jsx b/frontend/src/pages/login/index.jsx index 1cefbc0..534598c 100644 --- a/frontend/src/pages/login/index.jsx +++ b/frontend/src/pages/login/index.jsx @@ -28,7 +28,7 @@ export default function Login() { {/* Imagem (Some no celular, aparece no PC) */}
GTA VI diff --git a/frontend/src/pages/members/index.jsx b/frontend/src/pages/members/index.jsx index f265492..397dc8c 100644 --- a/frontend/src/pages/members/index.jsx +++ b/frontend/src/pages/members/index.jsx @@ -13,7 +13,7 @@ export default function Members() { return (
-

+

Amantes de jogos, críticos e amigos:

Encontre os membros mais populares essa semana

diff --git a/frontend/src/pages/profile/Sections/EditProfileModal.jsx b/frontend/src/pages/profile/Sections/EditProfileModal.jsx index 5c8ae78..f8f2612 100644 --- a/frontend/src/pages/profile/Sections/EditProfileModal.jsx +++ b/frontend/src/pages/profile/Sections/EditProfileModal.jsx @@ -157,13 +157,13 @@ export default function EditProfileModal({ user, onClose }) {
{avatarOptions.map((avatar) => { - const selected = form.pfp === avatar.url; + const selected = form.pfp === avatar.id; return (
From e200d9d57a0b323a8a96c619e553055b571945f0 Mon Sep 17 00:00:00 2001 From: joaopneves1570 Date: Mon, 30 Nov 2026 17:15:42 -0300 Subject: [PATCH 14/17] =?UTF-8?q?fix:=20rotas=20com=20nomes=20trocados=20n?= =?UTF-8?q?o=20backend=20e=20mudan=C3=A7as=20de=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/routes/list.py | 55 +-------------- backend/src/routes/review.py | 4 +- backend/src/routes/user.py | 4 +- frontend/src/pages/feed/index.jsx | 6 +- frontend/src/pages/gamePage/index.jsx | 20 ++---- frontend/src/pages/games/index.jsx | 90 ++++++++++++++++++++---- frontend/src/pages/home/Hero.jsx | 4 +- frontend/src/pages/login/index.jsx | 20 +++++- frontend/src/pages/membersList/index.jsx | 20 ++++-- frontend/src/pages/register/index.jsx | 68 ++++++++++++------ 10 files changed, 173 insertions(+), 118 deletions(-) diff --git a/backend/src/routes/list.py b/backend/src/routes/list.py index c509ab5..f4bebf0 100644 --- a/backend/src/routes/list.py +++ b/backend/src/routes/list.py @@ -204,7 +204,7 @@ async def view_lists(page_query = Depends(dep.validate_queries(["name", "created else: l.rel = RelationshipStatus.ANY - lists_page_with_urls = pag.convert_cursors_to_paths(lists_page, path) + lists_page_with_urls = pag.convert_cursors_to_urls(lists_page, path) return JSONResponse(lists_page_with_urls.model_dump()) @@ -231,62 +231,11 @@ async def view_lists_with_game(game_id: int, page_query = Depends(dep.validate_q else: l.rel = RelationshipStatus.ANY - list_games_page_with_urls = pag.convert_cursors_to_paths(lists_page, path) + list_games_page_with_urls = pag.convert_cursors_to_urls(lists_page, path) return JSONResponse(list_games_page_with_urls.model_dump()) -@list_router.get("/search") -async def view_lists(page_query = Depends(dep.validate_queries(["name", "created_at", "save_count"], "!save_count")), - conn = Depends(dep.get_conn), user_id = Depends(dep.optional_login), path = Depends(dep.get_current_url)): - """Busca listas do gamerboxd""" - - lists_page = await DB_read_lists(conn, user_id, page_query) - - # Verifica qual o relacionamento do usuário que está vendo com cada lista - for l in lists_page.content: - - if user_id is not None: - if l.creator.user_id == user_id: - l.rel = RelationshipStatus.OWNER - else: - has_saved = await DB_read_user_has_saved_list(conn, l.list_id, user_id) - l.rel = RelationshipStatus.SAVED if has_saved else RelationshipStatus.ANY - - else: - l.rel = RelationshipStatus.ANY - - lists_page_with_urls = pag.convert_cursors_to_paths(lists_page, path) - - return JSONResponse(lists_page_with_urls.model_dump()) - - -@list_router.get("/search/{game_id}") -async def view_lists_with_game(game_id: int, page_query = Depends(dep.validate_queries(["name", "created_at", "save_count"], "!save_count")), - conn = Depends(dep.get_conn), user_id = Depends(dep.optional_login), path = Depends(dep.get_current_url)): - """Busca listas do gamerboxd que contém um certo game""" - - if await DB_read_game_basic(conn, game_id) is None: - raise err.QueryError(404, err.GAME_NOT_FOUND_MSG) - - lists_page = await DB_read_lists_with_game(conn, user_id, game_id, page_query) - - # Verifica qual o relacionamento do usuário que está vendo com cada lista - for l in lists_page.content: - if user_id is not None: - if l.creator.user_id == user_id: - l.rel = RelationshipStatus.OWNER - else: - has_saved = await DB_read_user_has_saved_list(conn, l.list_id, user_id) - l.rel = RelationshipStatus.SAVED if has_saved else RelationshipStatus.ANY - - else: - l.rel = RelationshipStatus.ANY - - list_games_page_with_urls = pag.convert_cursors_to_paths(lists_page, path) - - return JSONResponse(list_games_page_with_urls.model_dump()) - @list_router.get("/{list_id}") async def view_list_data(list_id: str, conn = Depends(dep.get_conn), user_id = Depends(dep.optional_login)): diff --git a/backend/src/routes/review.py b/backend/src/routes/review.py index 05e0a58..5051c58 100644 --- a/backend/src/routes/review.py +++ b/backend/src/routes/review.py @@ -129,7 +129,7 @@ async def get_reviews(page_query = Depends(dep.validate_queries(["title", "creat else: r.rel = RelationshipStatus.ANY - reviews_page_with_urls = pag.convert_cursors_to_paths(reviews_page, path) + reviews_page_with_urls = pag.convert_cursors_to_urls(reviews_page, path) return JSONResponse(reviews_page_with_urls.model_dump()) @@ -154,7 +154,7 @@ async def get_reviews_with_game(game_id: int, page_query = Depends(dep.validate_ else: r.rel = RelationshipStatus.ANY - reviews_page_with_urls = pag.convert_cursors_to_paths(reviews_page, path) + reviews_page_with_urls = pag.convert_cursors_to_urls(reviews_page, path) return JSONResponse(reviews_page_with_urls.model_dump()) diff --git a/backend/src/routes/user.py b/backend/src/routes/user.py index d8d3f1c..46cf66b 100644 --- a/backend/src/routes/user.py +++ b/backend/src/routes/user.py @@ -226,7 +226,7 @@ async def user_suggestions(page_query = Depends(dep.validate_queries(["username" """Busca os usuários com 2 grau de relação do usuário autenticado""" suggestions_page = await DB_read_follow_suggestions_page(conn, user_id, page_query) - suggestions_page_with_url = pag.convert_cursors_to_paths(suggestions_page, url) + suggestions_page_with_url = pag.convert_cursors_to_urls(suggestions_page, url) return JSONResponse(suggestions_page_with_url.model_dump()) @@ -237,7 +237,7 @@ async def search_users(page_query = Depends(dep.validate_queries(["username", "r """Busca usuários do gamerboxd""" search_page = await DB_read_users_page(conn, user_id, page_query) - search_page_with_url = pag.convert_cursors_to_paths(search_page, url) + search_page_with_url = pag.convert_cursors_to_urls(search_page, url) return JSONResponse(search_page_with_url.model_dump()) diff --git a/frontend/src/pages/feed/index.jsx b/frontend/src/pages/feed/index.jsx index 7117c85..1b27d95 100644 --- a/frontend/src/pages/feed/index.jsx +++ b/frontend/src/pages/feed/index.jsx @@ -1,4 +1,3 @@ -import { getAvatarUrl } from "../../utils/profileImages"; import { useState } from "react"; import { Link } from "react-router-dom"; import { ArrowUpRight, User } from "lucide-react"; @@ -12,6 +11,7 @@ import { useGetSuggestions, useGetUser } from "../../hooks/useUsers"; import { useMe } from "../../hooks/useAuth"; import { toCardGame } from "../../services/gameService"; import { getErrorMessage } from "../../api/errors"; +import { getAvatarUrl } from "../../utils/profileImages"; export default function Feed() { const { data: me } = useMe(); @@ -66,7 +66,7 @@ export default function Feed() {
{members.map(member =>
- {member.pfp ? : } + {getAvatarUrl(member.pfp) ? : }

{member.username}

{member.followers ?? 0} seguidores

@@ -96,4 +96,4 @@ function QueryState({ query, empty, message }) { if (query.isError) return
{getErrorMessage(query.error)}
; if (query.isSuccess && empty) return

{message}

; return null; -} +} \ No newline at end of file diff --git a/frontend/src/pages/gamePage/index.jsx b/frontend/src/pages/gamePage/index.jsx index 2b20870..bc3a5ef 100644 --- a/frontend/src/pages/gamePage/index.jsx +++ b/frontend/src/pages/gamePage/index.jsx @@ -8,8 +8,9 @@ import { import Card from "../../components/gameCard"; import Review from "../../components/gameReview"; -import list from "../../assets/icons/lista.svg"; import ReviewModal from "../../components/ReviewModal"; +import Rating from "../../components/Rating"; +import list from "../../assets/icons/lista.svg"; import { useMe } from "../../hooks/useAuth"; import { @@ -32,6 +33,7 @@ import { useSearchLists, } from "../../hooks/useLists"; + const compact = new Intl.NumberFormat("pt-BR", { notation: "compact" }); const fmt = (n) => compact.format(n ?? 0); @@ -397,21 +399,9 @@ function RatingBox({ game, onAvaliar, canReview }) { } function Stars({ value = 0, className = "" }) { - const pct = (Math.max(0, Math.min(5, value)) / 5) * 100; - return ( - - ★★★★★ - - ★★★★★ - + + ); } diff --git a/frontend/src/pages/games/index.jsx b/frontend/src/pages/games/index.jsx index d2fcf74..fbbcfe1 100644 --- a/frontend/src/pages/games/index.jsx +++ b/frontend/src/pages/games/index.jsx @@ -1,10 +1,12 @@ import { useState, useEffect, useRef } from "react"; import { Link, useLocation } from "react-router-dom"; import Card from "../../components/gameCard"; +import Review from "../../components/gameReview"; import { useGames, useAllGames } from "../../hooks/useGames"; import { toCardGame } from "../../services/gameService"; import { useUserGameReview } from "../../hooks/useReviews"; +import { useSearchReviews } from "../../hooks/useReviews"; import { sortGames, inDecade } from "../../utils/gameFilters"; @@ -199,10 +201,14 @@ function Filter({ sort, decade, onSort, onDecade, onClear, hasFilter }) { return (
- Filtrar por + + Filtros em breve! +
- {FILTERS.map((filter, i) => { + {/* FILTROS AINDA NÃO FUNCIONAM, POR ENQUANTO DEIXAREMOS SEM */} + + {/* {FILTERS.map((filter, i) => { const selected = selectedOf(filter); const isOpen = open === filter.key; @@ -278,7 +284,7 @@ function Filter({ sort, decade, onSort, onDecade, onClear, hasFilter }) { )}
); - })} + })} */}
{hasFilter && ( @@ -540,17 +546,77 @@ function FilteredGrid({ search, sort, decade, onBack }) { ); } + function PopularReviews() { + const [order, setOrder] = useState("!created_at"); + const reviews = useSearchReviews({ pageSize: 5, order }); + const reviewItems = reviews.data?.pages.flatMap((page) => page.content) ?? []; + return ( -
-
-

- Avaliações populares da semana -

+
+ +
+ {[ + ["!created_at", "Recentes"], + ["!like_count", "Mais curtidas"], + ].map(([value, label]) => ( + + ))}
-

- As avaliações em destaque estarão disponíveis em breve. -

-
+ +
+ {reviewItems.map((review) => ( +
+ +
+ ))} +
+ {reviews.hasNextPage && ( + + )} + ); } + +function SectionHeading({ title, to, label }) { + const animatedLink = + "text-white/80 text-lg hover:cursor-pointer relative inline-block z-10 overflow-hidden before:absolute before:inset-0 before:bg-roxo before:-z-10 before:scale-x-0 before:origin-left before:transition-transform before:duration-300 hover:before:scale-x-100 px-4 py-1 rounded-2xl"; + + return
+

{title}

+ {label} +
; +} + +function QueryState({ query, empty, message }) { + if (query.isLoading) return

Carregando...

; + if (query.isError) return
{getErrorMessage(query.error)}
; + if (query.isSuccess && empty) return

{message}

; + return null; +} \ No newline at end of file diff --git a/frontend/src/pages/home/Hero.jsx b/frontend/src/pages/home/Hero.jsx index 4e3401d..01c1039 100644 --- a/frontend/src/pages/home/Hero.jsx +++ b/frontend/src/pages/home/Hero.jsx @@ -24,8 +24,8 @@ export default function HeroParallax() { mediaType="image" title="GAMERBOXD" scrollHint="Role para explorar" - startWidth={6} - startHeight={2} + startWidth={0} + startHeight={0} startRadius={24} endRadius={0} mediaZoom={2} diff --git a/frontend/src/pages/login/index.jsx b/frontend/src/pages/login/index.jsx index d114260..71061bb 100644 --- a/frontend/src/pages/login/index.jsx +++ b/frontend/src/pages/login/index.jsx @@ -1,4 +1,5 @@ import { Link } from "react-router-dom"; +import { Eye, EyeOff } from "lucide-react"; import { useLogin } from "../../hooks/useAuth"; import { useState } from "react"; import { useNavigate } from "react-router-dom"; @@ -8,6 +9,8 @@ export default function Login() { const [emailOrUsername, setEmailOrUsername] = useState(""); const [password, setPassword] = useState(""); + const [showPassword, setShowPassword] = useState(false); + const login = useLogin(); const navigate = useNavigate(); @@ -19,7 +22,10 @@ export default function Login() { navigate("/feed", { replace: true }); } }) + } + function handleVisionToggle() { + setShowPassword((prev) => !prev); } return ( @@ -67,16 +73,24 @@ export default function Login() { />
-
+
setPassword(e.target.value)} required - className="w-full border-b border-gray-300 py-2 outline-none text-white placeholder-gray-400 bg-transparent focus:border-[#8b7df0] transition-colors" + className="w-full border-b border-gray-300 py-2 outline-none text-white placeholder-gray-400 bg-transparent focus:border-roxo transition-colors" /> +
-
+
setConfirmPassword(e.target.value)} required className="w-full border-b border-gray-300 py-2 outline-none text-white placeholder-gray-400 bg-transparent focus:border-[#8b7df0] transition-colors" /> +
@@ -126,8 +152,8 @@ export default function Register() { - {register.isError && errorCardMessage(getErrorMessage(register.error))} - + {register.isError && + errorCardMessage(getErrorMessage(register.error))}
@@ -135,11 +161,13 @@ export default function Register() { } function errorCardMessage(error) { - return ( -
+
Ops! {error}
); -} \ No newline at end of file +} From c0caa02b448b110598d40b7c8558aef0e345ab4f Mon Sep 17 00:00:00 2001 From: joaopneves1570 Date: Mon, 30 Nov 2026 17:28:19 -0300 Subject: [PATCH 15/17] ultimos ajustes --- frontend/src/pages/feed/index.jsx | 2 +- frontend/src/pages/games/index.jsx | 4 +- frontend/src/pages/members/index.jsx | 142 ++++++++++++++++----------- 3 files changed, 91 insertions(+), 57 deletions(-) diff --git a/frontend/src/pages/feed/index.jsx b/frontend/src/pages/feed/index.jsx index 1b27d95..73b388d 100644 --- a/frontend/src/pages/feed/index.jsx +++ b/frontend/src/pages/feed/index.jsx @@ -66,7 +66,7 @@ export default function Feed() {
{members.map(member =>
- {getAvatarUrl(member.pfp) ? : } + {getAvatarUrl(member.pfp) ? : }

{member.username}

{member.followers ?? 0} seguidores

diff --git a/frontend/src/pages/games/index.jsx b/frontend/src/pages/games/index.jsx index fbbcfe1..a3d23fc 100644 --- a/frontend/src/pages/games/index.jsx +++ b/frontend/src/pages/games/index.jsx @@ -3,6 +3,8 @@ import { Link, useLocation } from "react-router-dom"; import Card from "../../components/gameCard"; import Review from "../../components/gameReview"; +import { getErrorMessage } from "../../api/errors"; + import { useGames, useAllGames } from "../../hooks/useGames"; import { toCardGame } from "../../services/gameService"; import { useUserGameReview } from "../../hooks/useReviews"; @@ -589,7 +591,7 @@ function PopularReviews() {
))} -
+
import { getErrorMessage } from "../../api/errors"; {reviews.hasNextPage && (
@@ -28,9 +29,9 @@ export default function Members() { } function PopularMembers() { - const navigate = useNavigate() + const navigate = useNavigate(); - const {data, isLoading, isError, error} = useGetUsers({ + const { data, isLoading, isError, error } = useGetUsers({ pageSize: 6, order: "!follower_count", }); @@ -47,7 +48,10 @@ function PopularMembers() { Membros mais populares essa semana

- @@ -55,22 +59,21 @@ function PopularMembers() {
{popularMembers.map((user) => ( {getAvatarUrl(user.pfp) ? ( {user.username} + src={getAvatarUrl(user.pfp)} + alt={user.username} + className="w-24 h-24 md:w-32 md:h-32 rounded-full object-cover border-4 border-zinc-700 shadow-lg" + /> ) : (
)} -

{user.username} @@ -88,8 +91,9 @@ function PopularMembers() { } function SuggestedMembers() { + const navigate = useNavigate(); - const { data, isLoading, isError, error } = useGetSuggestions({ + const { data, isLoading, isError, error, refetch } = useGetSuggestions({ pageSize: 6, order: "!follower_count", }); @@ -99,7 +103,6 @@ function SuggestedMembers() { const animatedLink = "text-white/80 text-lg hover:cursor-pointer relative inline-block z-10 overflow-hidden before:absolute before:inset-0 before:bg-roxo before:-z-10 before:scale-x-0 before:origin-left before:transition-transform before:duration-300 hover:before:scale-x-100 px-4 py-1 rounded-2xl"; - return (
@@ -107,51 +110,82 @@ function SuggestedMembers() { Membros sugeridos com base nos seus amigos

-
- {suggestedMembers.length === 0 ? ( + {isLoading ? ( +
+
+

Carregando membros sugeridos...

+
+ ) : isError ? ( +
+

+ Não foi possível carregar os membros sugeridos. +

+ +

{getErrorMessage(error)}

+ + +
+ ) : suggestedMembers.length === 0 ? (

Nenhum membro sugerido no momento.

) : (
- {suggestedMembers.map((user) => ( -
- {getAvatarUrl(user.pfp) ? ( - {user.username} - ) : ( -
- -
- )} - - -

- {user.username} -

- -

- {formatNumber(user.liked)} jogos • {formatNumber(user.reviews)} reviews -

-
- ))} -
+ {suggestedMembers.map((user) => ( + + {getAvatarUrl(user.pfp) ? ( + {user.username} + ) : ( +
+ +
+ )} + +

+ {user.username} +

+ +

+ {formatNumber(user.liked)} jogos + {" • "} + {formatNumber(user.reviews)} reviews +

+ + ))} +
)}
- ) + ); } - function MembersList() { const animatedLink = "text-white/80 text-lg hover:cursor-pointer relative inline-block z-10 overflow-hidden before:absolute before:inset-0 before:bg-roxo before:-z-10 before:scale-x-0 before:origin-left before:transition-transform before:duration-300 hover:before:scale-x-100 px-4 py-1 rounded-2xl"; @@ -159,7 +193,7 @@ function MembersList() { const navigate = useNavigate(); const { data, isLoading, isError, error } = useGetUsers({ pageSize: 10, - order: "!review_count" + order: "!review_count", }); const members = data?.pages[0]?.content ?? []; @@ -167,21 +201,19 @@ function MembersList() { return (
-

- Todos os membros -

+

Todos os membros

-
{members.slice(0, 8).map((user) => ( - + ))}
From f999d09b393ab5aba43d131bfd72003e4eba22c7 Mon Sep 17 00:00:00 2001 From: joaopneves1570 Date: Mon, 30 Nov 2026 17:47:53 -0300 Subject: [PATCH 16/17] =?UTF-8?q?fix:=20configura=C3=A7=C3=A3o=20de=20ambi?= =?UTF-8?q?ente=20de=20testes=20do=20frontend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/setupTests.js | 24 +++++++++++++++++++++- frontend/src/App.test.jsx | 43 ++++++++++++++++++++++++++++++--------- 2 files changed, 56 insertions(+), 11 deletions(-) diff --git a/frontend/setupTests.js b/frontend/setupTests.js index 331666c..19b584b 100644 --- a/frontend/setupTests.js +++ b/frontend/setupTests.js @@ -1 +1,23 @@ -import '@testing-library/jest-dom'; \ No newline at end of file +import "@testing-library/jest-dom"; +import { vi } from "vitest"; + +vi.stubGlobal( + "ResizeObserver", + class ResizeObserver { + observe() {} + unobserve() {} + disconnect() {} + } +); + +vi.stubGlobal( + "IntersectionObserver", + class IntersectionObserver { + observe() {} + unobserve() {} + disconnect() {} + takeRecords() { + return []; + } + } +); \ No newline at end of file diff --git a/frontend/src/App.test.jsx b/frontend/src/App.test.jsx index d11a0f6..e61d431 100644 --- a/frontend/src/App.test.jsx +++ b/frontend/src/App.test.jsx @@ -1,12 +1,35 @@ -import { render } from '@testing-library/react'; -import { describe, it, expect } from 'vitest'; -import App from './App'; // Ajuste o caminho se necessário - -describe('Componente App', () => { - it('deve renderizar corretamente', () => { - render(); - // Aqui você pode buscar por um texto que sabe que existe na sua tela inicial - // Exemplo: expect(screen.getByText(/Gamerboxd/i)).toBeInTheDocument(); - expect(true).toBe(true); // Teste bobo só para garantir que a engrenagem funciona +import { render, screen } from "@testing-library/react"; +import { describe, it, expect, vi } from "vitest"; +import { MemoryRouter } from "react-router-dom"; +import { QueryClient, QueryClientProvider } from "@tanstack/react-query"; +import App from "./App"; + +vi.mock("./services/authService", () => ({ + getMe: vi.fn().mockResolvedValue(null), + login: vi.fn(), + logout: vi.fn(), +})); + +describe("Componente App", () => { + it("deve renderizar corretamente", async () => { + const queryClient = new QueryClient({ + defaultOptions: { + queries: { + retry: false, + }, + }, }); + + render( + + + + + + ); + + expect( + await screen.findByPlaceholderText("Senha") + ).toBeInTheDocument(); + }); }); \ No newline at end of file From a8cfde73d72b9b3c8547d18efaa70ed3962cce9d Mon Sep 17 00:00:00 2001 From: joaopneves1570 Date: Mon, 30 Nov 2026 17:53:24 -0300 Subject: [PATCH 17/17] atualizando git ignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d87442b..1ba77a1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .venv/ .env +.env.production __pycache__/ .pytest_cache/ node_modules/