Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/companies/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export default function CompaniesPage() {
<SelectContent>
{industries.map((industry) => (
<SelectItem key={industry} value={industry}>
{industry}
{industry === 'All' ? 'All' : industry.charAt(0).toUpperCase() + industry.slice(1)}
</SelectItem>
))}
</SelectContent>
Expand Down
61 changes: 42 additions & 19 deletions app/dashboard/company/[slug]/settings/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ export default function CompanySettingsPage() {
email: currentCompany?.email || '',
phone: currentCompany?.phone || '',
address: {
street: currentCompany?.address?.street || '',
city: currentCompany?.address?.city || '',
state: currentCompany?.address?.state || '',
country: currentCompany?.address?.country || '',
zip: currentCompany?.address?.zip || '',
street: currentCompany?.address_street || '',
city: currentCompany?.address_city || '',
state: currentCompany?.address_state || '',
country: currentCompany?.address_country || '',
zip: currentCompany?.address_zip || '',
},
socials: {
linkedin: currentCompany?.socials?.linkedin || '',
twitter: currentCompany?.socials?.twitter || '',
facebook: currentCompany?.socials?.facebook || '',
instagram: currentCompany?.socials?.instagram || '',
linkedin: currentCompany?.linkedin_url || '',
twitter: currentCompany?.twitter_url || '',
facebook: currentCompany?.facebook_url || '',
instagram: currentCompany?.instagram_url || '',
},
})

Expand All @@ -85,17 +85,17 @@ export default function CompanySettingsPage() {
email: currentCompany.email || '',
phone: currentCompany.phone || '',
address: {
street: currentCompany.address?.street || '',
city: currentCompany.address?.city || '',
state: currentCompany.address?.state || '',
country: currentCompany.address?.country || '',
zip: currentCompany.address?.zip || '',
street: currentCompany.address_street || '',
city: currentCompany.address_city || '',
state: currentCompany.address_state || '',
country: currentCompany.address_country || '',
zip: currentCompany.address_zip || '',
},
socials: {
linkedin: currentCompany.socials?.linkedin || '',
twitter: currentCompany.socials?.twitter || '',
facebook: currentCompany.socials?.facebook || '',
instagram: currentCompany.socials?.instagram || '',
linkedin: currentCompany.linkedin_url || '',
twitter: currentCompany.twitter_url || '',
facebook: currentCompany.facebook_url || '',
instagram: currentCompany.instagram_url || '',
},
})
}
Expand Down Expand Up @@ -197,12 +197,35 @@ export default function CompanySettingsPage() {

setLoading(true)
try {
// Flatten address and socials objects to match database schema
const updateData = {
name: formData.name,
legal_name: formData.legal_name,
description: formData.description,
website: formData.website,
industry: formData.industry,
company_size: formData.company_size,
email: formData.email,
phone: formData.phone,
// Flatten address fields
address_street: formData.address.street,
address_city: formData.address.city,
address_state: formData.address.state,
address_country: formData.address.country,
address_zip: formData.address.zip,
// Flatten social fields
linkedin_url: formData.socials.linkedin,
twitter_url: formData.socials.twitter,
facebook_url: formData.socials.facebook,
instagram_url: formData.socials.instagram,
}

const response = await fetch(`/api/companies/${currentCompany.slug}`, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(formData),
body: JSON.stringify(updateData),
})

if (!response.ok) {
Expand Down
4 changes: 2 additions & 2 deletions components/companies/CompanyCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function CompanyCard({
</CardTitle>
{company.industry && (
<CardDescription className="text-xs mt-1">
{company.industry}
{company.industry.charAt(0).toUpperCase() + company.industry.slice(1)}
</CardDescription>
)}
</div>
Expand All @@ -63,7 +63,7 @@ export function CompanyCard({
{company.company_size && (
<Badge variant="secondary" className="text-xs">
<Users className="h-3 w-3 mr-1" />
{company.company_size}
{company.company_size.charAt(0).toUpperCase() + company.company_size.slice(1)}
</Badge>
)}
{company.address?.city && (
Expand Down
6 changes: 3 additions & 3 deletions components/companies/CompanyProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ export function CompanyProfile({ company, isOwner = false, className }: CompanyP
{company.industry && (
<Badge variant="secondary">
<Building2 className="h-3 w-3 mr-1" />
{company.industry}
{company.industry.charAt(0).toUpperCase() + company.industry.slice(1)}
</Badge>
)}
{company.company_size && (
<Badge variant="outline">
<Users className="h-3 w-3 mr-1" />
{company.company_size}
{company.company_size.charAt(0).toUpperCase() + company.company_size.slice(1)}
</Badge>
)}
{company.subscription_tier !== 'free' && (
<Badge variant="default">
<Award className="h-3 w-3 mr-1" />
{company.subscription_tier}
{company.subscription_tier.charAt(0).toUpperCase() + company.subscription_tier.slice(1)}
</Badge>
)}
</div>
Expand Down
13 changes: 13 additions & 0 deletions types/company.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,21 @@ export interface Company {
company_size?: 'startup' | 'small' | 'medium' | 'large' | 'enterprise'
email: string
phone?: string
// Nested address object (for backward compatibility)
address?: CompanyAddress
// Flattened address fields (actual database columns)
address_street?: string
address_city?: string
address_state?: string
address_country?: string
address_zip?: string
// Nested socials object (for backward compatibility)
socials?: CompanySocials
// Flattened social fields (actual database columns)
linkedin_url?: string
twitter_url?: string
facebook_url?: string
instagram_url?: string
verification_status: 'pending' | 'verified' | 'rejected'
verification_documents?: string[]
verified_at?: string
Expand Down
Loading