feat: Simplify URL structure to rmaps.online/<room>
- Move room page from /room/[slug] to /[slug] - Update all navigation links to use /<slug> format - Update share URL generation - Update middleware for subdomain handling 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
96fea103fd
commit
912104f740
|
|
@ -55,7 +55,7 @@ export default function HomePage() {
|
|||
localStorage.setItem('rmaps_user', JSON.stringify({ name, emoji }));
|
||||
|
||||
// Navigate to the room (will create it if it doesn't exist)
|
||||
router.push(`/room/${slug}`);
|
||||
router.push(`/${slug}`);
|
||||
};
|
||||
|
||||
const handleJoinRoom = () => {
|
||||
|
|
@ -65,7 +65,7 @@ export default function HomePage() {
|
|||
|
||||
// Clean the slug
|
||||
const cleanSlug = joinSlug.toLowerCase().replace(/[^a-z0-9-]/g, '');
|
||||
router.push(`/room/${cleanSlug}`);
|
||||
router.push(`/${cleanSlug}`);
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -10,12 +10,11 @@ interface ShareModalProps {
|
|||
export default function ShareModal({ roomSlug, onClose }: ShareModalProps) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
// In production, this would be <slug>.rmaps.online
|
||||
// For now, use path-based routing
|
||||
// Share URL uses the cleaner /<slug> format
|
||||
const shareUrl =
|
||||
typeof window !== 'undefined'
|
||||
? `${window.location.origin}/room/${roomSlug}`
|
||||
: `https://rmaps.online/room/${roomSlug}`;
|
||||
? `${window.location.origin}/${roomSlug}`
|
||||
: `https://rmaps.online/${roomSlug}`;
|
||||
|
||||
const subdomainUrl = `https://${roomSlug}.rmaps.online`;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import type { NextRequest } from 'next/server';
|
|||
* Routes:
|
||||
* - rmaps.online -> home page
|
||||
* - www.rmaps.online -> home page
|
||||
* - <room>.rmaps.online -> /room/<room>
|
||||
* - <room>.rmaps.online -> /<room>
|
||||
*
|
||||
* Also handles localhost for development
|
||||
*/
|
||||
|
|
@ -36,9 +36,9 @@ export function middleware(request: NextRequest) {
|
|||
|
||||
// If we have a subdomain, rewrite to the room page
|
||||
if (subdomain && subdomain.length > 0) {
|
||||
// Don't rewrite if already on /room/ path
|
||||
if (!url.pathname.startsWith('/room/')) {
|
||||
url.pathname = `/room/${subdomain}${url.pathname === '/' ? '' : url.pathname}`;
|
||||
// Only rewrite if at root path (subdomain becomes the room)
|
||||
if (url.pathname === '/') {
|
||||
url.pathname = `/${subdomain}`;
|
||||
return NextResponse.rewrite(url);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue