Revert to URLs without @

This commit is contained in:
Austin Chen 2021-12-17 10:55:18 -08:00
parent cda5810589
commit 022caa4407
3 changed files with 3 additions and 7 deletions

View File

@ -12,11 +12,10 @@ import { SEO } from './SEO'
export function UserLink(props: { displayName: string; className?: string }) {
const { displayName, className } = props
// Fix this when users can change their own names
const username = displayName.replace(/\s+/g, '')
return (
<Link href={`/@${username}`}>
<Link href={`/${username}`}>
<a
className={clsx(
'hover:underline hover:decoration-indigo-400 hover:decoration-2',

View File

@ -41,7 +41,7 @@ export function path(contract: Contract) {
// For now, derive username from creatorName
// Fix this when users can change their own names
const username = contract.creatorName.replace(/\s+/g, '')
return `/@${username}/${contract.id}`
return `/${username}/${contract.id}`
}
export function compute(contract: Contract) {

View File

@ -8,11 +8,8 @@ import { useUser } from '../../hooks/use-user'
export default function UserProfile() {
const router = useRouter()
const atUsername = router.query.username as string | undefined
const username = atUsername?.substring(1) || '' // Remove the initial @
const [user, setUser] = useState<User | null | 'loading'>('loading')
const { username } = router.query as { username: string }
useEffect(() => {
if (username) {
getUserByUsername(username).then(setUser)