feat: changed profile pictures in reviews to squares, changed sorting buttons

This commit is contained in:
Moyasee
2025-10-02 01:30:44 +03:00
parent 461da55070
commit 19cf24ef48
4 changed files with 47 additions and 31 deletions

View File

@@ -666,7 +666,7 @@ export function GameDetailsContent() {
navigate(`/profile/${review.user.id}`) navigate(`/profile/${review.user.id}`)
} }
onKeyDown={(e) => { onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') { if (e.key === "Enter" || e.key === " ") {
e.preventDefault(); e.preventDefault();
review.user?.id && review.user?.id &&
navigate(`/profile/${review.user.id}`); navigate(`/profile/${review.user.id}`);

View File

@@ -252,7 +252,7 @@ $hero-height: 300px;
&__review-avatar { &__review-avatar {
width: 32px; width: 32px;
height: 32px; height: 32px;
border-radius: 50%; border-radius: 4px;
object-fit: cover; object-fit: cover;
border: 2px solid rgba(255, 255, 255, 0.1); border: 2px solid rgba(255, 255, 255, 0.1);
} }

View File

@@ -61,6 +61,21 @@
} }
} }
&__toggle-option {
&.active {
background: rgba(255, 255, 255, 0.05);
border-radius: 4px;
padding: 6px 8px;
border: 1px solid rgba(255, 255, 255, 0.1);
}
&:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.03);
border-radius: 4px;
padding: 6px 8px;
}
}
&__separator { &__separator {
color: rgba(255, 255, 255, 0.3); color: rgba(255, 255, 255, 0.3);
font-size: 14px; font-size: 14px;

View File

@@ -1,8 +1,7 @@
import { import {
CalendarIcon,
StarIcon,
ThumbsupIcon, ThumbsupIcon,
ClockIcon, ChevronUpIcon,
ChevronDownIcon,
} from "@primer/octicons-react"; } from "@primer/octicons-react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import "./review-sort-options.scss"; import "./review-sort-options.scss";
@@ -25,44 +24,46 @@ export function ReviewSortOptions({
}: ReviewSortOptionsProps) { }: ReviewSortOptionsProps) {
const { t } = useTranslation("game_details"); const { t } = useTranslation("game_details");
const handleDateToggle = () => {
const newSort = sortBy === "newest" ? "oldest" : "newest";
onSortChange(newSort);
};
const handleScoreToggle = () => {
const newSort = sortBy === "score_high" ? "score_low" : "score_high";
onSortChange(newSort);
};
const handleMostVotedClick = () => {
onSortChange("most_voted");
};
const isDateActive = sortBy === "newest" || sortBy === "oldest";
const isScoreActive = sortBy === "score_high" || sortBy === "score_low";
const isMostVotedActive = sortBy === "most_voted";
return ( return (
<div className="review-sort-options__container"> <div className="review-sort-options__container">
<div className="review-sort-options__options"> <div className="review-sort-options__options">
<button <button
className={`review-sort-options__option ${sortBy === "newest" ? "active" : ""}`} className={`review-sort-options__option review-sort-options__toggle-option ${isDateActive ? "active" : ""}`}
onClick={() => onSortChange("newest")} onClick={handleDateToggle}
> >
<CalendarIcon size={16} /> {sortBy === "newest" ? <ChevronDownIcon size={16} /> : <ChevronUpIcon size={16} />}
<span>{t("sort_newest")}</span> <span>{sortBy === "oldest" ? t("sort_oldest") : t("sort_newest")}</span>
</button> </button>
<span className="review-sort-options__separator">|</span> <span className="review-sort-options__separator">|</span>
<button <button
className={`review-sort-options__option ${sortBy === "oldest" ? "active" : ""}`} className={`review-sort-options__option review-sort-options__toggle-option ${isScoreActive ? "active" : ""}`}
onClick={() => onSortChange("oldest")} onClick={handleScoreToggle}
> >
<ClockIcon size={16} /> {sortBy === "score_high" ? <ChevronDownIcon size={16} /> : <ChevronUpIcon size={16} />}
<span>{t("sort_oldest")}</span> <span>{sortBy === "score_low" ? t("sort_lowest_score") : t("sort_highest_score")}</span>
</button> </button>
<span className="review-sort-options__separator">|</span> <span className="review-sort-options__separator">|</span>
<button <button
className={`review-sort-options__option ${sortBy === "score_high" ? "active" : ""}`} className={`review-sort-options__option ${isMostVotedActive ? "active" : ""}`}
onClick={() => onSortChange("score_high")} onClick={handleMostVotedClick}
>
<StarIcon size={16} />
<span>{t("sort_highest_score")}</span>
</button>
<span className="review-sort-options__separator">|</span>
<button
className={`review-sort-options__option ${sortBy === "score_low" ? "active" : ""}`}
onClick={() => onSortChange("score_low")}
>
<StarIcon size={16} />
<span>{t("sort_lowest_score")}</span>
</button>
<span className="review-sort-options__separator">|</span>
<button
className={`review-sort-options__option ${sortBy === "most_voted" ? "active" : ""}`}
onClick={() => onSortChange("most_voted")}
> >
<ThumbsupIcon size={16} /> <ThumbsupIcon size={16} />
<span>{t("sort_most_voted")}</span> <span>{t("sort_most_voted")}</span>