This repository has been archived by the owner on Sep 21, 2024. It is now read-only.
forked from pixelaw/web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from pixelaw/fix/some-UIUXs
fix: some UIUX errors and add emoji to each address.
- Loading branch information
Showing
12 changed files
with
183 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
const colors = [ | ||
'#FC5C54', | ||
'#FFD95A', | ||
'#E95D72', | ||
'#6A87C8', | ||
'#5FD0F3', | ||
'#75C06B', | ||
'#FFDD86', | ||
'#5FC6D4', | ||
'#FF949A', | ||
'#FF8024', | ||
'#9BA1A4', | ||
'#EC66FF', | ||
'#FF8CBC', | ||
'#FF9A23', | ||
'#C5DADB', | ||
'#A8CE63', | ||
'#71ABFF', | ||
'#FFE279', | ||
'#B6B1B6', | ||
'#FF6780', | ||
'#A575FF', | ||
'#4D82FF', | ||
'#FFB35A', | ||
] as const; | ||
|
||
const avatars = [ | ||
{ color: colors[0], emoji: '🌶' }, | ||
{ color: colors[1], emoji: '🤑' }, | ||
{ color: colors[2], emoji: '🐙' }, | ||
{ color: colors[3], emoji: '🫐' }, | ||
{ color: colors[4], emoji: '🐳' }, | ||
{ color: colors[0], emoji: '🤶' }, | ||
{ color: colors[5], emoji: '🌲' }, | ||
{ color: colors[6], emoji: '🌞' }, | ||
{ color: colors[7], emoji: '🐒' }, | ||
{ color: colors[8], emoji: '🐵' }, | ||
{ color: colors[9], emoji: '🦊' }, | ||
{ color: colors[10], emoji: '🐼' }, | ||
{ color: colors[11], emoji: '🦄' }, | ||
{ color: colors[12], emoji: '🐷' }, | ||
{ color: colors[13], emoji: '🐧' }, | ||
{ color: colors[8], emoji: '🦩' }, | ||
{ color: colors[14], emoji: '👽' }, | ||
{ color: colors[0], emoji: '🎈' }, | ||
{ color: colors[8], emoji: '🍉' }, | ||
{ color: colors[1], emoji: '🎉' }, | ||
{ color: colors[15], emoji: '🐲' }, | ||
{ color: colors[16], emoji: '🌎' }, | ||
{ color: colors[17], emoji: '🍊' }, | ||
{ color: colors[18], emoji: '🐭' }, | ||
{ color: colors[19], emoji: '🍣' }, | ||
{ color: colors[1], emoji: '🐥' }, | ||
{ color: colors[20], emoji: '👾' }, | ||
{ color: colors[15], emoji: '🥦' }, | ||
{ color: colors[0], emoji: '👹' }, | ||
{ color: colors[17], emoji: '🙀' }, | ||
{ color: colors[4], emoji: '⛱' }, | ||
{ color: colors[21], emoji: '⛵️' }, | ||
{ color: colors[17], emoji: '🥳' }, | ||
{ color: colors[8], emoji: '🤯' }, | ||
{ color: colors[22], emoji: '🤠' }, | ||
] as const; | ||
|
||
function hashCode(text: string) { | ||
let hash = 0; | ||
if (text.length === 0) return hash; | ||
for (let i = 0; i < text.length; i++) { | ||
const chr = text.charCodeAt(i); | ||
hash = (hash << 5) - hash + chr; | ||
hash |= 0; | ||
} | ||
return hash; | ||
} | ||
|
||
export function emojiAvatarForAddress(address: string) { | ||
const resolvedAddress = typeof address === 'string' ? address : ''; | ||
const avatarIndex = Math.abs(hashCode(resolvedAddress.toLowerCase()) % avatars.length); | ||
return avatars[avatarIndex ?? 0]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,7 @@ | ||
.loadingContainer { | ||
@apply fixed inset-0 z-50 flex items-center justify-center bg-primary/90; | ||
@apply fixed inset-0 z-50 flex items-center justify-center bg-bg-primary/90; | ||
} | ||
|
||
.loadingText { | ||
@apply text-3xl font-bold text-white; | ||
animation: loadingAnimation 1s steps(4, end) infinite; | ||
} | ||
|
||
@keyframes loadingAnimation { | ||
0% { | ||
content: 'Loading.'; | ||
} | ||
25% { | ||
content: 'Loading..'; | ||
} | ||
50% { | ||
content: 'Loading...'; | ||
} | ||
75% { | ||
content: 'Loading...'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,27 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import styles from './Loading.module.css'; | ||
|
||
const Loading = () => ( | ||
<div className={styles.loadingContainer}> | ||
<span className={styles.loadingText}>Loading...</span> | ||
</div> | ||
); | ||
const Loading: React.FC = () => { | ||
const [loadingText, setLoadingText] = useState('Loading.'); | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setLoadingText(prev => { | ||
if (prev === 'Loading...') { | ||
return 'Loading.'; | ||
} | ||
return prev + '.'; | ||
}); | ||
}, 500); | ||
|
||
return () => clearInterval(interval); | ||
}, []); | ||
|
||
return ( | ||
<div className={styles.loadingContainer}> | ||
<span className={styles.loadingText}>{loadingText}</span> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Loading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.