mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-29 05:41:03 +00:00
Fix: Format-check fail and translations. Feat: added animations to upvote and downvote buttons
This commit is contained in:
@@ -213,7 +213,6 @@
|
|||||||
"leave_a_review": "Leave a Review",
|
"leave_a_review": "Leave a Review",
|
||||||
"write_review_placeholder": "Share your thoughts about this game...",
|
"write_review_placeholder": "Share your thoughts about this game...",
|
||||||
"sort_newest": "Newest",
|
"sort_newest": "Newest",
|
||||||
"sort_by": "Sort by",
|
|
||||||
"no_reviews_yet": "No reviews yet",
|
"no_reviews_yet": "No reviews yet",
|
||||||
"be_first_to_review": "Be the first to share your thoughts about this game!",
|
"be_first_to_review": "Be the first to share your thoughts about this game!",
|
||||||
"sort_oldest": "Oldest",
|
"sort_oldest": "Oldest",
|
||||||
@@ -226,7 +225,6 @@
|
|||||||
"loading_reviews": "Loading reviews...",
|
"loading_reviews": "Loading reviews...",
|
||||||
"loading_more_reviews": "Loading more reviews...",
|
"loading_more_reviews": "Loading more reviews...",
|
||||||
"load_more_reviews": "Load More Reviews",
|
"load_more_reviews": "Load More Reviews",
|
||||||
"youve_played_for_hours": "You've played for {{hours}} hours",
|
|
||||||
"would_you_recommend_this_game": "Would you like to leave a review to this game?",
|
"would_you_recommend_this_game": "Would you like to leave a review to this game?",
|
||||||
"yes": "Yes",
|
"yes": "Yes",
|
||||||
"maybe_later": "Maybe Later",
|
"maybe_later": "Maybe Later",
|
||||||
@@ -330,8 +328,8 @@
|
|||||||
"delete_review": "Delete review",
|
"delete_review": "Delete review",
|
||||||
"delete_review_modal_title": "Are you sure you want to delete your review?",
|
"delete_review_modal_title": "Are you sure you want to delete your review?",
|
||||||
"delete_review_modal_description": "This action cannot be undone.",
|
"delete_review_modal_description": "This action cannot be undone.",
|
||||||
"delete_review_button": "Delete",
|
"delete_review_modal_delete_button": "Delete",
|
||||||
"delete_review_karma_warning": "You will lose any karma points earned from this review."
|
"delete_review_modal_cancel_button": "Cancel"
|
||||||
},
|
},
|
||||||
"activation": {
|
"activation": {
|
||||||
"title": "Activate Hydra",
|
"title": "Activate Hydra",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { ThumbsUp, ThumbsDown } from "lucide-react";
|
|||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useEditor, EditorContent } from "@tiptap/react";
|
import { useEditor, EditorContent } from "@tiptap/react";
|
||||||
import StarterKit from "@tiptap/starter-kit";
|
import StarterKit from "@tiptap/starter-kit";
|
||||||
|
import { motion } from "framer-motion";
|
||||||
import type { GameReview } from "@types";
|
import type { GameReview } from "@types";
|
||||||
|
|
||||||
import { HeroPanel } from "./hero";
|
import { HeroPanel } from "./hero";
|
||||||
@@ -131,7 +132,7 @@ export function GameDetailsContent() {
|
|||||||
},
|
},
|
||||||
handlePaste: (view, event) => {
|
handlePaste: (view, event) => {
|
||||||
// Strip formatting from pasted content to prevent overflow issues
|
// Strip formatting from pasted content to prevent overflow issues
|
||||||
const text = event.clipboardData?.getData('text/plain') || '';
|
const text = event.clipboardData?.getData("text/plain") || "";
|
||||||
const currentText = view.state.doc.textContent;
|
const currentText = view.state.doc.textContent;
|
||||||
const remainingChars = MAX_REVIEW_CHARS - currentText.length;
|
const remainingChars = MAX_REVIEW_CHARS - currentText.length;
|
||||||
|
|
||||||
@@ -293,7 +294,12 @@ export function GameDetailsContent() {
|
|||||||
console.log("reviewScore:", reviewScore);
|
console.log("reviewScore:", reviewScore);
|
||||||
console.log("submittingReview:", submittingReview);
|
console.log("submittingReview:", submittingReview);
|
||||||
|
|
||||||
if (!objectId || !reviewHtml.trim() || submittingReview || reviewCharCount > MAX_REVIEW_CHARS) {
|
if (
|
||||||
|
!objectId ||
|
||||||
|
!reviewHtml.trim() ||
|
||||||
|
submittingReview ||
|
||||||
|
reviewCharCount > MAX_REVIEW_CHARS
|
||||||
|
) {
|
||||||
console.log("Early return - validation failed");
|
console.log("Early return - validation failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -584,7 +590,13 @@ export function GameDetailsContent() {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div className="game-details__review-char-counter">
|
<div className="game-details__review-char-counter">
|
||||||
<span className={reviewCharCount > MAX_REVIEW_CHARS ? "over-limit" : ""}>
|
<span
|
||||||
|
className={
|
||||||
|
reviewCharCount > MAX_REVIEW_CHARS
|
||||||
|
? "over-limit"
|
||||||
|
: ""
|
||||||
|
}
|
||||||
|
>
|
||||||
{reviewCharCount}/{MAX_REVIEW_CHARS}
|
{reviewCharCount}/{MAX_REVIEW_CHARS}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -624,7 +636,9 @@ export function GameDetailsContent() {
|
|||||||
className="game-details__review-submit-button"
|
className="game-details__review-submit-button"
|
||||||
onClick={handleSubmitReview}
|
onClick={handleSubmitReview}
|
||||||
disabled={
|
disabled={
|
||||||
!editor?.getHTML().trim() || submittingReview || reviewCharCount > MAX_REVIEW_CHARS
|
!editor?.getHTML().trim() ||
|
||||||
|
submittingReview ||
|
||||||
|
reviewCharCount > MAX_REVIEW_CHARS
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{submittingReview
|
{submittingReview
|
||||||
@@ -739,24 +753,56 @@ export function GameDetailsContent() {
|
|||||||
/>
|
/>
|
||||||
<div className="game-details__review-actions">
|
<div className="game-details__review-actions">
|
||||||
<div className="game-details__review-votes">
|
<div className="game-details__review-votes">
|
||||||
<button
|
<motion.button
|
||||||
className={`game-details__vote-button game-details__vote-button--upvote ${review.hasUpvoted ? "game-details__vote-button--active" : ""}`}
|
className={`game-details__vote-button game-details__vote-button--upvote ${review.hasUpvoted ? "game-details__vote-button--active" : ""}`}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleVoteReview(review.id, "upvote")
|
handleVoteReview(review.id, "upvote")
|
||||||
}
|
}
|
||||||
|
whileTap={{
|
||||||
|
scale: 0.9,
|
||||||
|
transition: { duration: 0.1 },
|
||||||
|
}}
|
||||||
|
whileHover={{
|
||||||
|
scale: 1.05,
|
||||||
|
transition: { duration: 0.2 },
|
||||||
|
}}
|
||||||
|
animate={
|
||||||
|
review.hasUpvoted
|
||||||
|
? {
|
||||||
|
scale: [1, 1.2, 1],
|
||||||
|
transition: { duration: 0.3 },
|
||||||
|
}
|
||||||
|
: {}
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<ThumbsUp size={16} />
|
<ThumbsUp size={16} />
|
||||||
<span>{review.upvotes || 0}</span>
|
<span>{review.upvotes || 0}</span>
|
||||||
</button>
|
</motion.button>
|
||||||
<button
|
<motion.button
|
||||||
className={`game-details__vote-button game-details__vote-button--downvote ${review.hasDownvoted ? "game-details__vote-button--active" : ""}`}
|
className={`game-details__vote-button game-details__vote-button--downvote ${review.hasDownvoted ? "game-details__vote-button--active" : ""}`}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
handleVoteReview(review.id, "downvote")
|
handleVoteReview(review.id, "downvote")
|
||||||
}
|
}
|
||||||
|
whileTap={{
|
||||||
|
scale: 0.9,
|
||||||
|
transition: { duration: 0.1 },
|
||||||
|
}}
|
||||||
|
whileHover={{
|
||||||
|
scale: 1.05,
|
||||||
|
transition: { duration: 0.2 },
|
||||||
|
}}
|
||||||
|
animate={
|
||||||
|
review.hasDownvoted
|
||||||
|
? {
|
||||||
|
scale: [1, 1.2, 1],
|
||||||
|
transition: { duration: 0.3 },
|
||||||
|
}
|
||||||
|
: {}
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<ThumbsDown size={16} />
|
<ThumbsDown size={16} />
|
||||||
<span>{review.downvotes || 0}</span>
|
<span>{review.downvotes || 0}</span>
|
||||||
</button>
|
</motion.button>
|
||||||
</div>
|
</div>
|
||||||
{userDetails?.id === review.user?.id && (
|
{userDetails?.id === review.user?.id && (
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ $hero-height: 300px;
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
border-color: globals.$brand-teal;
|
border-color: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,5 +15,6 @@
|
|||||||
&__actions {
|
&__actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ export function DeleteReviewModal({
|
|||||||
>
|
>
|
||||||
<div className="delete-review-modal__actions">
|
<div className="delete-review-modal__actions">
|
||||||
<Button onClick={onClose} theme="outline">
|
<Button onClick={onClose} theme="outline">
|
||||||
{t("cancel")}
|
{t("delete_review_modal_cancel_button")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Button onClick={handleDeleteReview} theme="danger">
|
<Button onClick={handleDeleteReview} theme="danger">
|
||||||
{t("delete_review_button")}
|
{t("delete_review_modal_delete_button")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
Reference in New Issue
Block a user