2022-01-06 13:04:03 +01:00
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import { Box, Typography } from "@mui/material";
|
|
|
|
|
|
|
|
import { Achievement } from "./Achievements";
|
2022-04-07 01:30:08 +02:00
|
|
|
import { Settings } from "../Settings/Settings";
|
2022-01-06 13:04:03 +01:00
|
|
|
import { AchievementIcon } from "./AchievementIcon";
|
|
|
|
|
|
|
|
interface IProps {
|
|
|
|
achievement: Achievement;
|
|
|
|
unlockedOn?: number;
|
|
|
|
cssFiltersUnlocked: string;
|
|
|
|
cssFiltersLocked: string;
|
|
|
|
}
|
|
|
|
|
2022-04-07 01:30:08 +02:00
|
|
|
export function AchievementEntry({
|
|
|
|
achievement,
|
|
|
|
unlockedOn,
|
|
|
|
cssFiltersUnlocked,
|
|
|
|
cssFiltersLocked,
|
|
|
|
}: IProps): JSX.Element {
|
2022-01-06 13:04:03 +01:00
|
|
|
if (!achievement) return <></>;
|
|
|
|
const isUnlocked = !!unlockedOn;
|
|
|
|
|
|
|
|
const mainColor = isUnlocked ? Settings.theme.primary : Settings.theme.secondarylight;
|
|
|
|
|
2022-04-07 01:30:08 +02:00
|
|
|
let achievedOn = "";
|
2022-01-06 13:04:03 +01:00
|
|
|
if (unlockedOn) {
|
|
|
|
achievedOn = new Date(unlockedOn).toLocaleString();
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2022-04-07 01:30:08 +02:00
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
border: `1px solid ${Settings.theme.well}`,
|
|
|
|
mb: 2,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
display: "flex",
|
|
|
|
flexDirection: "row",
|
|
|
|
flexWrap: "wrap",
|
|
|
|
}}
|
|
|
|
>
|
2022-01-06 13:04:03 +01:00
|
|
|
<AchievementIcon
|
2022-04-07 01:30:08 +02:00
|
|
|
achievement={achievement}
|
|
|
|
unlocked={isUnlocked}
|
|
|
|
size="72px"
|
|
|
|
colorFilters={isUnlocked ? cssFiltersUnlocked : cssFiltersLocked}
|
|
|
|
/>
|
|
|
|
<Box
|
|
|
|
sx={{
|
|
|
|
display: "flex",
|
|
|
|
flexDirection: "column",
|
|
|
|
justifyContent: "center",
|
|
|
|
px: 1,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<Typography variant="h6" sx={{ color: mainColor }}>
|
2022-01-06 13:04:03 +01:00
|
|
|
{achievement.Name}
|
|
|
|
</Typography>
|
2022-04-07 01:30:08 +02:00
|
|
|
<Typography variant="body2" sx={{ maxWidth: "500px", color: mainColor }}>
|
2022-01-06 13:04:03 +01:00
|
|
|
{achievement.Description}
|
|
|
|
</Typography>
|
|
|
|
{isUnlocked && (
|
2022-04-07 01:30:08 +02:00
|
|
|
<Typography variant="caption" sx={{ fontSize: "12px", color: Settings.theme.primarydark }}>
|
2022-01-06 13:04:03 +01:00
|
|
|
Acquired on {achievedOn}
|
|
|
|
</Typography>
|
|
|
|
)}
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
}
|