mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +00:00
feat: adjustments
This commit is contained in:
parent
6c6d13e387
commit
584f725eda
2 changed files with 105 additions and 45 deletions
|
@ -33,11 +33,12 @@ interface AchievementListProps {
|
||||||
otherUser: UserInfo | null;
|
otherUser: UserInfo | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AchievementPanelProps {
|
interface AchievementSummaryProps {
|
||||||
user: UserInfo;
|
user: UserInfo;
|
||||||
|
isComparison?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AchievementPanel({ user }: AchievementPanelProps) {
|
function AchievementSummary({ user, isComparison }: AchievementSummaryProps) {
|
||||||
const { userDetails, hasActiveSubscription } = useUserDetails();
|
const { userDetails, hasActiveSubscription } = useUserDetails();
|
||||||
|
|
||||||
const userTotalAchievementCount = user.achievements.length;
|
const userTotalAchievementCount = user.achievements.length;
|
||||||
|
@ -61,8 +62,55 @@ function AchievementPanel({ user }: AchievementPanelProps) {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (userDetails?.id == user.userId && !hasActiveSubscription) {
|
if (
|
||||||
return <></>;
|
isComparison &&
|
||||||
|
userDetails?.id == user.userId &&
|
||||||
|
!hasActiveSubscription
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
gap: `${SPACING_UNIT * 2}px`,
|
||||||
|
alignItems: "center",
|
||||||
|
position: "relative",
|
||||||
|
padding: `${SPACING_UNIT}px`,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
zIndex: 2,
|
||||||
|
inset: 0,
|
||||||
|
width: "100%",
|
||||||
|
height: "100%",
|
||||||
|
background: "rgba(0, 0, 0, 0.7)",
|
||||||
|
display: "flex",
|
||||||
|
alignItems: "center",
|
||||||
|
flexDirection: "row",
|
||||||
|
gap: `${SPACING_UNIT}px`,
|
||||||
|
borderRadius: "4px",
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LockIcon size={24} />
|
||||||
|
<h3>Assine o HYDRA CLOUD para comparar suas conquistas!!!!</h3>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
gap: `${SPACING_UNIT * 2}px`,
|
||||||
|
alignItems: "center",
|
||||||
|
height: "62px",
|
||||||
|
position: "relative",
|
||||||
|
filter: "blur(4px)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{getProfileImage(user)}
|
||||||
|
<h1 style={{ marginBottom: "8px" }}>{user.displayName}</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -71,6 +119,7 @@ function AchievementPanel({ user }: AchievementPanelProps) {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
gap: `${SPACING_UNIT * 2}px`,
|
gap: `${SPACING_UNIT * 2}px`,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
padding: `${SPACING_UNIT}px`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{getProfileImage(user)}
|
{getProfileImage(user)}
|
||||||
|
@ -126,7 +175,7 @@ function AchievementList({ user, otherUser }: AchievementListProps) {
|
||||||
const { t } = useTranslation("achievement");
|
const { t } = useTranslation("achievement");
|
||||||
const { formatDateTime } = useDate();
|
const { formatDateTime } = useDate();
|
||||||
|
|
||||||
const { userDetails } = useUserDetails();
|
const { hasActiveSubscription } = useUserDetails();
|
||||||
|
|
||||||
if (!otherUserAchievements || otherUserAchievements.length === 0) {
|
if (!otherUserAchievements || otherUserAchievements.length === 0) {
|
||||||
return (
|
return (
|
||||||
|
@ -167,7 +216,12 @@ function AchievementList({ user, otherUser }: AchievementListProps) {
|
||||||
<li
|
<li
|
||||||
key={index}
|
key={index}
|
||||||
className={styles.listItem}
|
className={styles.listItem}
|
||||||
style={{ display: "grid", gridTemplateColumns: "3fr 1fr 1fr" }}
|
style={{
|
||||||
|
display: "grid",
|
||||||
|
gridTemplateColumns: hasActiveSubscription
|
||||||
|
? "3fr 1fr 1fr"
|
||||||
|
: "3fr 2fr",
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
@ -191,6 +245,33 @@ function AchievementList({ user, otherUser }: AchievementListProps) {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{hasActiveSubscription ? (
|
||||||
|
achievements[index].unlocked ? (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
whiteSpace: "nowrap",
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
gap: `${SPACING_UNIT}px`,
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CheckCircleIcon />
|
||||||
|
<small>{formatDateTime(achievements[index].unlockTime!)}</small>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
padding: `${SPACING_UNIT}px`,
|
||||||
|
justifyContent: "center",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<LockIcon />
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
) : null}
|
||||||
|
|
||||||
{otherUserAchievement.unlocked ? (
|
{otherUserAchievement.unlocked ? (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
@ -215,31 +296,6 @@ function AchievementList({ user, otherUser }: AchievementListProps) {
|
||||||
<LockIcon />
|
<LockIcon />
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{userDetails?.subscription && achievements[index].unlocked ? (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
whiteSpace: "nowrap",
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "row",
|
|
||||||
gap: `${SPACING_UNIT}px`,
|
|
||||||
justifyContent: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CheckCircleIcon />
|
|
||||||
<small>{formatDateTime(achievements[index].unlockTime!)}</small>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
padding: `${SPACING_UNIT}px`,
|
|
||||||
justifyContent: "center",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<LockIcon />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -270,7 +326,7 @@ export function AchievementsContent({ otherUser }: AchievementsContentProps) {
|
||||||
|
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
|
||||||
const { userDetails } = useUserDetails();
|
const { userDetails, hasActiveSubscription } = useUserDetails();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (gameTitle) {
|
if (gameTitle) {
|
||||||
|
@ -359,19 +415,20 @@ export function AchievementsContent({ otherUser }: AchievementsContentProps) {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
width: "100%",
|
width: "100%",
|
||||||
gap: `${SPACING_UNIT * 2}px`,
|
gap: `${SPACING_UNIT}px`,
|
||||||
padding: `${SPACING_UNIT * 2}px`,
|
padding: `${SPACING_UNIT}px`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<AchievementPanel
|
<AchievementSummary
|
||||||
user={{
|
user={{
|
||||||
...userDetails,
|
...userDetails,
|
||||||
userId: userDetails.id,
|
userId: userDetails.id,
|
||||||
achievements: sortedAchievements,
|
achievements: sortedAchievements,
|
||||||
}}
|
}}
|
||||||
|
isComparison={otherUser !== null}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{otherUser && <AchievementPanel user={otherUser} />}
|
{otherUser && <AchievementSummary user={otherUser} />}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -380,15 +437,15 @@ export function AchievementsContent({ otherUser }: AchievementsContentProps) {
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns: "3fr 1fr 1fr",
|
gridTemplateColumns: hasActiveSubscription
|
||||||
|
? "3fr 1fr 1fr"
|
||||||
|
: "3fr 2fr",
|
||||||
gap: `${SPACING_UNIT * 2}px`,
|
gap: `${SPACING_UNIT * 2}px`,
|
||||||
padding: `${SPACING_UNIT}px ${SPACING_UNIT * 3}px`,
|
padding: `${SPACING_UNIT}px ${SPACING_UNIT * 3}px`,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div style={{ display: "flex", justifyContent: "center" }}>
|
{hasActiveSubscription && (
|
||||||
{getProfileImage(otherUser)}
|
|
||||||
</div>
|
|
||||||
<div style={{ display: "flex", justifyContent: "center" }}>
|
<div style={{ display: "flex", justifyContent: "center" }}>
|
||||||
{getProfileImage({
|
{getProfileImage({
|
||||||
...userDetails,
|
...userDetails,
|
||||||
|
@ -396,6 +453,10 @@ export function AchievementsContent({ otherUser }: AchievementsContentProps) {
|
||||||
achievements: sortedAchievements,
|
achievements: sortedAchievements,
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
<div style={{ display: "flex", justifyContent: "center" }}>
|
||||||
|
{getProfileImage(otherUser)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -52,7 +52,6 @@ export const heroImage = style({
|
||||||
|
|
||||||
export const heroContent = style({
|
export const heroContent = style({
|
||||||
padding: `${SPACING_UNIT * 2}px`,
|
padding: `${SPACING_UNIT * 2}px`,
|
||||||
height: "100%",
|
|
||||||
width: "100%",
|
width: "100%",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
justifyContent: "space-between",
|
justifyContent: "space-between",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue