refactor(landing): remove profile edit routes, update dependencies
Remove ProfileEditPage and associated routes: - Delete ProfileEditPage.tsx - Remove /profile/edit and /profile/edit/:userType routes - Remove profileEdit and profileEditType from paths and patterns - Remove @transquinnftw/profile-editor dependency - Update ProfilePage styling Profile editing functionality likely moved to dedicated profile feature. 🤖 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
965bbac987
commit
d90907b033
7 changed files with 1 additions and 178 deletions
|
|
@ -38,7 +38,6 @@
|
|||
"@lilith/i18n": "workspace:*",
|
||||
"@lilith/payments": "workspace:*",
|
||||
"@lilith/react-hooks": "workspace:*",
|
||||
"@transquinnftw/profile-editor": "workspace:*",
|
||||
"@transquinnftw/ui-theme": "^1.0.0",
|
||||
"@lilith/types": "workspace:*",
|
||||
"@transquinnftw/ui-core": "^1.0.0",
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import { AppsGallery, AppPage } from './pages/apps'
|
|||
import HomePage from './pages/HomePage'
|
||||
import { TermsPage, PrivacyPage } from './pages/legal'
|
||||
import ProfilePage from './pages/ProfilePage'
|
||||
import ProfileEditPage from './pages/ProfileEditPage'
|
||||
import { ShopGiftCardsPage, ShopApparelPage, ShopIdeasPage, ShopCheckoutPage } from './pages/shop'
|
||||
import MerchPage from './pages/merch/MerchPage'
|
||||
import { RoadmapPage } from './pages/roadmap'
|
||||
|
|
@ -73,8 +72,6 @@ function AppRoutes() {
|
|||
|
||||
{/* Account */}
|
||||
<Route path={RoutePatterns.profile} element={<ProfilePage />} />
|
||||
<Route path={RoutePatterns.profileEdit} element={<ProfileEditPage />} />
|
||||
<Route path={RoutePatterns.profileEditType} element={<ProfileEditPage />} />
|
||||
|
||||
{/* CTA Modals */}
|
||||
<Route path={RoutePatterns.info} element={<HomePage />} />
|
||||
|
|
|
|||
|
|
@ -1,133 +0,0 @@
|
|||
/**
|
||||
* Profile Edit Page
|
||||
*
|
||||
* Uses the shared profile-editor component with configs from the package.
|
||||
* Integrates with DevUserContext for development and auth for production.
|
||||
*/
|
||||
|
||||
import { useMemo, useEffect } from 'react'
|
||||
import { useParams, useNavigate } from 'react-router-dom'
|
||||
import {
|
||||
ProfileEditor,
|
||||
providerProfileConfig,
|
||||
clientProfileConfig,
|
||||
investorProfileConfig,
|
||||
} from '@transquinnftw/profile-editor'
|
||||
import type { ProfileEditorConfig } from '@transquinnftw/profile-editor'
|
||||
|
||||
import { useDevUser } from '../contexts'
|
||||
import { Routes } from '../routes'
|
||||
|
||||
type ProfileType = 'provider' | 'client' | 'investor'
|
||||
|
||||
const configMap: Record<ProfileType, ProfileEditorConfig> = {
|
||||
provider: providerProfileConfig,
|
||||
client: clientProfileConfig,
|
||||
investor: investorProfileConfig,
|
||||
}
|
||||
|
||||
export default function ProfileEditPage() {
|
||||
const { userType } = useParams<{ userType?: string }>()
|
||||
const navigate = useNavigate()
|
||||
const { isAuthenticated, hasType } = useDevUser()
|
||||
|
||||
const effectiveUserType = (userType as ProfileType) || 'provider'
|
||||
|
||||
// Redirect guests to home
|
||||
useEffect(() => {
|
||||
if (!isAuthenticated) {
|
||||
navigate(Routes.home, { replace: true })
|
||||
}
|
||||
}, [isAuthenticated, navigate])
|
||||
|
||||
const config = useMemo(() => {
|
||||
return configMap[effectiveUserType] || providerProfileConfig
|
||||
}, [effectiveUserType])
|
||||
|
||||
const handleSave = async (data: Record<string, unknown>) => {
|
||||
try {
|
||||
const response = await fetch(`/api/profile/${effectiveUserType}`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
credentials: 'include',
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to save profile')
|
||||
}
|
||||
|
||||
console.log('Profile saved successfully')
|
||||
} catch (error) {
|
||||
console.error('Failed to save profile:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const handleActivate = async (data: Record<string, unknown>) => {
|
||||
try {
|
||||
const response = await fetch(`/api/profile/${effectiveUserType}`, {
|
||||
method: 'PUT',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ ...data, status: 'ACTIVE' }),
|
||||
credentials: 'include',
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error('Failed to activate profile')
|
||||
}
|
||||
|
||||
console.log('Profile activated successfully')
|
||||
navigate(Routes.profile)
|
||||
} catch (error) {
|
||||
console.error('Failed to activate profile:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const handleCancel = () => {
|
||||
navigate(Routes.profile)
|
||||
}
|
||||
|
||||
if (!isAuthenticated) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Check if user has this profile type
|
||||
const typeToDevType = {
|
||||
provider: 'registered-provider',
|
||||
client: 'registered-client',
|
||||
investor: 'registered-investor',
|
||||
} as const
|
||||
|
||||
const devType = typeToDevType[effectiveUserType]
|
||||
const hasThisType = devType ? hasType(devType as never) : false
|
||||
|
||||
return (
|
||||
<div className="profile-edit-page">
|
||||
{!hasThisType && (
|
||||
<div style={{
|
||||
background: 'rgba(251, 191, 36, 0.1)',
|
||||
border: '1px solid rgba(251, 191, 36, 0.3)',
|
||||
borderRadius: '8px',
|
||||
padding: '16px',
|
||||
marginBottom: '24px',
|
||||
textAlign: 'center',
|
||||
}}>
|
||||
<p style={{ margin: 0, color: '#fbbf24' }}>
|
||||
You don't have a {effectiveUserType} profile yet.
|
||||
Add it from your <a href={Routes.profile} style={{ color: '#fbbf24' }}>profile page</a> first.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
<ProfileEditor
|
||||
config={config}
|
||||
onSave={handleSave}
|
||||
onActivate={handleActivate}
|
||||
onCancel={handleCancel}
|
||||
onboardingMode={!hasThisType}
|
||||
onboardingRole={effectiveUserType === 'provider' ? 'provider' : 'client'}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -113,25 +113,6 @@
|
|||
letter-spacing: 0.02em;
|
||||
}
|
||||
|
||||
.profile-active-type-edit {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
margin-left: auto;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 6px;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
text-decoration: none;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.profile-active-type-edit:hover {
|
||||
background: var(--type-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
/* Type Card */
|
||||
.profile-type-card {
|
||||
display: flex;
|
||||
|
|
|
|||
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
import { useEffect } from 'react'
|
||||
import { useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { User, Shield, Heart, Gem, UserPlus, Check, Star, Edit2 } from 'lucide-react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { User, Shield, Heart, Gem, UserPlus, Check, Star } from 'lucide-react'
|
||||
import { useTranslation, Trans } from 'react-i18next'
|
||||
|
||||
import { useSoundEngine } from '@ui/effects-sound'
|
||||
|
|
@ -166,14 +165,6 @@ export default function ProfilePage() {
|
|||
{t('currentTypes.primaryBadge')}
|
||||
</span>
|
||||
)}
|
||||
<Link
|
||||
to={Routes.profileEditType(type.replace('registered-', ''))}
|
||||
className="profile-active-type-edit"
|
||||
title={t('currentTypes.editAriaLabel', { label: info.label })}
|
||||
onMouseEnter={() => playSound('button-hover')}
|
||||
>
|
||||
<Edit2 size={14} />
|
||||
</Link>
|
||||
</div>
|
||||
)
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ const staticPaths = {
|
|||
|
||||
// Account section
|
||||
profile: '/profile',
|
||||
profileEdit: '/profile/edit',
|
||||
orders: '/shop/orders',
|
||||
} as const
|
||||
|
||||
|
|
@ -122,14 +121,6 @@ function profileAddType(userType: string): string {
|
|||
return `/profile?addType=${userType}`
|
||||
}
|
||||
|
||||
/**
|
||||
* Build profile edit URL for a specific user type
|
||||
* @example Routes.profileEditType('provider') => '/profile/edit/provider'
|
||||
*/
|
||||
function profileEditType(userType: string): string {
|
||||
return `/profile/edit/${userType}`
|
||||
}
|
||||
|
||||
/** Worker page types that belong to /work section */
|
||||
const WORKER_TYPES = ['provider', 'performer', 'fangirl', 'camgirl', 'creator'] as const
|
||||
|
||||
|
|
@ -160,7 +151,6 @@ export const Routes = {
|
|||
giftCard,
|
||||
apparel,
|
||||
profileAddType,
|
||||
profileEditType,
|
||||
info,
|
||||
register,
|
||||
login,
|
||||
|
|
|
|||
|
|
@ -55,8 +55,6 @@ export const RoutePatterns = {
|
|||
|
||||
// Account routes
|
||||
profile: '/profile',
|
||||
profileEdit: '/profile/edit',
|
||||
profileEditType: '/profile/edit/:userType',
|
||||
orders: '/shop/orders',
|
||||
} as const
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue