Skip to content

Commit

Permalink
fix: default phone number
Browse files Browse the repository at this point in the history
  • Loading branch information
jimcase committed Aug 13, 2024
1 parent 1b164bd commit 46a0ef4
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ const VerifyWalletModal = () => {
const [verifyCurrentPaths, setVerifyCurrentPaths] = useState<
VerifyWalletFlow[]
>([VerifyWalletFlow.INTRO]);
const [defaultCountryCode] = useState<MuiTelInputCountry | undefined>("ES");

const getDefaultCountry = () => {
const language = navigator.language;
return language.split("-")[1] || "US";
};

const [defaultCountryCode] = useState<MuiTelInputCountry | undefined>(
// @ts-ignore
getDefaultCountry(),
);
const [phone, setPhone] = useState<string>("");
const [codes, setCodes] = useState(Array(6).fill(""));
const [phoneCodeIsBeenSending, setPhoneCodeIsBeenSending] =
Expand Down
71 changes: 36 additions & 35 deletions ui/summit-2024/src/pages/Leaderboard/Leaderboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const Leaderboard: React.FC = () => {
useEffect(() => {
getStats().then((response) => {
// @ts-ignore
setStats(response.categories);
setStats(response.categories);
});
}, []);

Expand All @@ -58,11 +58,11 @@ const Leaderboard: React.FC = () => {
const totalVotes = stats?.reduce((total, item) => total + item.votes, 0) || 0;

let selectedCategoryValue = -1;
if (dataForChart !== undefined && selected !== undefined){
selectedCategoryValue = dataForChart[selected].value;
if (dataForChart !== undefined && selected !== undefined) {
selectedCategoryValue = dataForChart[selected].value;
}

const handleSwitch = (option: string) => {
const handleSwitch = (option: string) => {
if (option !== content) {
setFade(false);
setTimeout(() => {
Expand Down Expand Up @@ -189,7 +189,7 @@ const Leaderboard: React.FC = () => {
lineHeight: "40px",
}}
>
{totalVotes}
{totalVotes}
</Typography>
<TableContainer>
<Table size="small">
Expand Down Expand Up @@ -227,36 +227,37 @@ const Leaderboard: React.FC = () => {
</TableRow>
</TableHead>
<TableBody>
{stats?.map(
(item, index) => (
<TableRow key={index}>
<TableCell
component="th"
scope="row"
sx={{
color:
theme.palette.text
.neutralLightest,
textShadow:
"0px 0px 12px rgba(18, 18, 18, 0.20)",
fontSize: "12px",
fontStyle: "normal",
fontWeight: 700,
lineHeight: "20px",
padding: "12px 0px",
}}
>
{item.id}
</TableCell>
<TableCell align="left">
{item.votes}
</TableCell>
<TableCell align="left">
{((item.votes / totalVotes) * 100).toFixed(2)}%
</TableCell>
</TableRow>
),
)}
{stats?.map((item, index) => (
<TableRow key={index}>
<TableCell
component="th"
scope="row"
sx={{
color:
theme.palette.text.neutralLightest,
textShadow:
"0px 0px 12px rgba(18, 18, 18, 0.20)",
fontSize: "12px",
fontStyle: "normal",
fontWeight: 700,
lineHeight: "20px",
padding: "12px 0px",
}}
>
{item.id}
</TableCell>
<TableCell align="left">
{item.votes}
</TableCell>
<TableCell align="left">
{(
(item.votes / totalVotes) *
100
).toFixed(2)}
%
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
Expand Down

0 comments on commit 46a0ef4

Please sign in to comment.