Skip to content

Commit 16f2d2e

Browse files
author
Gerome El-assaad
committed
cleaned up dead code
1 parent a6bc29b commit 16f2d2e

File tree

21 files changed

+95
-110
lines changed

21 files changed

+95
-110
lines changed

app/api/chat/route.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ export async function POST(req: Request) {
5858

5959
console.log('userID', userID)
6060
console.log('teamID', teamID)
61-
// console.log('template', template)
6261
console.log('model', model)
63-
// console.log('config', config)
6462

6563
const { model: modelNameString, apiKey: modelApiKey, ...modelParams } = config
6664
const modelClient = getModelClient(model, config)
@@ -71,7 +69,7 @@ export async function POST(req: Request) {
7169
schema,
7270
system: toPrompt(template),
7371
messages,
74-
maxRetries: 0, // do not retry on errors
72+
maxRetries: 0,
7573
...getDefaultModelParams(model),
7674
...modelParams,
7775
})

app/api/edge-flags/route.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { NextRequest, NextResponse } from 'next/server';
22
import { edgeConfigAdapter } from '@/lib/edge-config-adapter';
33
import { getAllFeatureFlags } from '@/flags';
44

5-
// Force dynamic rendering for this route
65
export const dynamic = 'force-dynamic';
76

87
export async function GET(request: NextRequest) {
@@ -12,9 +11,7 @@ export async function GET(request: NextRequest) {
1211
const featureKey = url.searchParams.get('feature');
1312

1413
if (useEdgeConfig) {
15-
// Use Edge Config adapter for faster response
1614
if (featureKey) {
17-
// Get specific feature
1815
const value = await edgeConfigAdapter.getFeatureValue(featureKey);
1916

2017
return NextResponse.json({
@@ -25,7 +22,6 @@ export async function GET(request: NextRequest) {
2522
timestamp: new Date().toISOString(),
2623
});
2724
} else {
28-
// Get all features from Edge Config
2925
const features = await edgeConfigAdapter.getAllFeatures();
3026
const featureData = await edgeConfigAdapter.getFeatureData();
3127

@@ -42,7 +38,6 @@ export async function GET(request: NextRequest) {
4238
});
4339
}
4440
} else {
45-
// Use standard GrowthBook integration
4641
const flags = await getAllFeatureFlags();
4742

4843
return NextResponse.json({
@@ -83,7 +78,6 @@ export async function POST(request: NextRequest) {
8378
);
8479
}
8580

86-
// Batch check multiple features
8781
const results: Record<string, any> = {};
8882

8983
for (const featureKey of features) {

app/api/flags/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { NextRequest, NextResponse } from 'next/server';
22
import { getAllFeatureFlags } from '@/flags';
33

4-
// Force dynamic rendering for this route
54
export const dynamic = 'force-dynamic';
65

76
export async function GET(request: NextRequest) {

app/api/terminal/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export async function POST(req: NextRequest) {
3434
const fullCommand = `cd "${workingDirectory}" && ${command}`
3535

3636
const result = await sandbox.commands.run(fullCommand, {
37-
timeoutMs: 30000, // 30 second timeout
37+
timeoutMs: 30000,
3838
})
3939

4040
return NextResponse.json({

app/deployments/page.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export default function DeploymentsPage() {
9898
}
9999

100100
const pollDeploymentStatus = async (deploymentId: string) => {
101-
const maxPolls = 60 // 5 minutes max
101+
const maxPolls = 60
102102
let polls = 0
103103

104104
const poll = async () => {
@@ -139,7 +139,7 @@ export default function DeploymentsPage() {
139139
}
140140
} else {
141141
polls++
142-
setTimeout(poll, 5000) // Poll every 5 seconds
142+
setTimeout(poll, 5000)
143143
}
144144
} catch (error) {
145145
console.error('Error polling deployment status:', error)
@@ -413,7 +413,7 @@ export default function DeploymentsPage() {
413413
<TabsContent value="history" className="flex-1">
414414
<DeploymentHistory
415415
deployments={deployments}
416-
onRedeploy={() => {}} // TODO: implement redeploy logic
416+
onRedeploy={() => {}}
417417
onRollback={(deployment) => rollbackDeployment(deployment.deploymentId)}
418418
/>
419419
</TabsContent>

app/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ export default function Home() {
9393

9494
useEffect(() => {
9595
if (lastMessage) {
96-
console.log('Last message:', lastMessage)
9796
}
9897
}, [lastMessage])
9998

app/providers.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
2727
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
2828
}
2929

30-
// Re-export AuthProvider from lib/auth-provider
3130
export { AuthProvider } from '../lib/auth-provider'

app/settings/account/page.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,8 @@ export default function AccountSettings() {
5656

5757
setIsLoading(true)
5858
try {
59-
// Set basic user data immediately from session
6059
setEmail(session.user.email || '')
6160
setEmailDirty(false)
62-
63-
// Try to load additional data with timeout
6461
const loadWithTimeout = Promise.race([
6562
Promise.all([
6663
getUserProfile(session.user.id),
@@ -91,7 +88,6 @@ export default function AccountSettings() {
9188
}
9289
} catch (dataError) {
9390
console.warn('Could not load extended user data, using defaults:', dataError)
94-
// Use default values - don't show error to user
9591
setEmailNotifications(true)
9692
setSecurityAlerts(true)
9793
setTwoFactorEnabled(false)
@@ -245,7 +241,6 @@ export default function AccountSettings() {
245241
const handleUpdateNotificationSettings = async (key: 'email_notifications' | 'security_alerts', value: boolean) => {
246242
if (!session?.user?.id || isUpdatingSettings) return
247243

248-
// Optimistically update the UI
249244
if (key === 'email_notifications') setEmailNotifications(value)
250245
if (key === 'security_alerts') setSecurityAlerts(value)
251246

@@ -265,7 +260,6 @@ export default function AccountSettings() {
265260
}
266261
} catch (error) {
267262
console.warn('Could not save notification settings to database:', error)
268-
// Revert optimistic update
269263
if (isMountedRef.current) {
270264
if (key === 'email_notifications') setEmailNotifications(!value)
271265
if (key === 'security_alerts') setSecurityAlerts(!value)
@@ -288,7 +282,6 @@ export default function AccountSettings() {
288282

289283
const newValue = !twoFactorEnabled
290284

291-
// Optimistically update the UI
292285
setTwoFactorEnabled(newValue)
293286
setIsUpdatingSettings(true)
294287

@@ -307,7 +300,6 @@ export default function AccountSettings() {
307300
}
308301
} catch (error) {
309302
console.warn('Could not save 2FA settings to database:', error)
310-
// Revert optimistic update
311303
if (isMountedRef.current) {
312304
setTwoFactorEnabled(!newValue)
313305
toast({
@@ -325,7 +317,7 @@ export default function AccountSettings() {
325317

326318
const validateAvatarFile = (file: File): string | null => {
327319
const allowedTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp']
328-
const maxSize = 2 * 1024 * 1024 // 2MB
320+
const maxSize = 2 * 1024 * 1024
329321

330322
if (!allowedTypes.includes(file.type)) {
331323
return 'Please upload a valid image file (JPG, PNG, GIF, or WebP)'
@@ -393,7 +385,6 @@ export default function AccountSettings() {
393385
if (isMountedRef.current) {
394386
setIsUploadingAvatar(false)
395387
}
396-
// Clear the input to allow re-uploading the same file
397388
if (event.target) {
398389
event.target.value = ''
399390
}

app/settings/appearance/page.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ import { cn } from '@/lib/utils'
1313
import { useAuth } from '@/lib/auth'
1414
import {
1515
getUserPreferences,
16-
updateUserPreferences,
17-
UserPreferences
18-
} from '@/lib/user-settings'
19-
import { themeCustomization, subscriptionTier } from '@/flags'
16+
updateUserPreferences} from '@/lib/user-settings'
2017
import { useFeatureFlag, useFeatureValue } from '@/hooks/use-edge-flags'
2118

2219
const themes = [
@@ -66,7 +63,6 @@ export default function AppearanceSettings() {
6663
const { session } = useAuth(() => {}, () => {})
6764
const { toast } = useToast()
6865

69-
// Feature flags
7066
const { enabled: hasThemeCustomization } = useFeatureFlag('theme-customization', false)
7167
const { value: userSubscriptionTier } = useFeatureValue<'free' | 'pro' | 'enterprise'>('subscription-tier', 'free')
7268

@@ -75,7 +71,6 @@ export default function AppearanceSettings() {
7571
const [isLoading, setIsLoading] = useState(true)
7672
const [isUpdating, setIsUpdating] = useState(false)
7773

78-
// Advanced customization options
7974
const [accentColor, setAccentColor] = useState('#3B82F6')
8075
const [borderRadius, setBorderRadius] = useState([8])
8176
const [animationsEnabled, setAnimationsEnabled] = useState(true)
@@ -119,11 +114,9 @@ export default function AppearanceSettings() {
119114

120115
setIsUpdating(true)
121116
try {
122-
123117
setSelectedTheme(newTheme)
124118
setTheme(newTheme)
125119

126-
127120
const success = await updateUserPreferences(session.user.id, {
128121
theme: newTheme
129122
})
@@ -134,7 +127,6 @@ export default function AppearanceSettings() {
134127
description: "Theme updated successfully.",
135128
})
136129
} else {
137-
138130
setSelectedTheme(selectedTheme)
139131
setTheme(selectedTheme)
140132
throw new Error('Failed to save theme preference')
@@ -156,13 +148,10 @@ export default function AppearanceSettings() {
156148

157149
setIsUpdating(true)
158150
try {
159-
160151
setSelectedFont(newFont)
161152

162-
163153
document.documentElement.style.fontFamily = getFontFamily(newFont)
164154

165-
166155
const success = await updateUserPreferences(session.user.id, {
167156
font_family: newFont
168157
})
@@ -173,7 +162,6 @@ export default function AppearanceSettings() {
173162
description: "Font updated successfully.",
174163
})
175164
} else {
176-
177165
setSelectedFont(selectedFont)
178166
document.documentElement.style.fontFamily = getFontFamily(selectedFont)
179167
throw new Error('Failed to save font preference')
@@ -203,7 +191,6 @@ export default function AppearanceSettings() {
203191
}
204192
}
205193

206-
207194
useEffect(() => {
208195
if (!isLoading) {
209196
document.documentElement.style.fontFamily = getFontFamily(selectedFont)
@@ -378,7 +365,6 @@ export default function AppearanceSettings() {
378365
</CardDescription>
379366
</CardHeader>
380367
<CardContent className="space-y-6">
381-
{/* Accent Color */}
382368
<div className="space-y-3">
383369
<Label className="text-sm font-medium">Accent Color</Label>
384370
<div className="flex items-center gap-4">
@@ -403,7 +389,6 @@ export default function AppearanceSettings() {
403389
</div>
404390
</div>
405391

406-
{/* Border Radius */}
407392
<div className="space-y-3">
408393
<Label className="text-sm font-medium">Border Radius</Label>
409394
<div className="flex items-center gap-4">
@@ -425,7 +410,6 @@ export default function AppearanceSettings() {
425410
</div>
426411
</div>
427412

428-
{/* Interface Options */}
429413
<div className="space-y-4">
430414
<div className="flex items-center justify-between">
431415
<div>
@@ -458,7 +442,6 @@ export default function AppearanceSettings() {
458442
</div>
459443
</div>
460444

461-
{/* Preview */}
462445
<div className="space-y-3">
463446
<Label className="text-sm font-medium flex items-center gap-2">
464447
<Eye className="w-4 h-4" />
@@ -496,7 +479,6 @@ export default function AppearanceSettings() {
496479
</Card>
497480
)}
498481

499-
{/* Upgrade CTA for free users */}
500482
{!hasThemeCustomization && userSubscriptionTier === 'free' && (
501483
<Card className="border-dashed">
502484
<CardHeader>

app/settings/billing/page.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,14 @@ export default function BillingSettings() {
5959
const { session, userTeam } = useAuth(() => {}, () => {})
6060
const { toast } = useToast()
6161

62-
// Feature flags
6362
const { enabled: hasAdvancedAnalytics } = useFeatureFlag('advanced-analytics', false)
6463
const { value: userSubscriptionTier } = useFeatureValue<'free' | 'pro' | 'enterprise'>('subscription-tier', 'free')
6564

6665
const [billingInfo, setBillingInfo] = useState<BillingInfo | null>(null)
6766
const [invoices, setInvoices] = useState<Invoice[]>([])
6867
const [isLoading, setIsLoading] = useState(true)
6968
const [isUpdating, setIsUpdating] = useState(false)
70-
const [analyticsData, setAnalyticsData] = useState({
69+
const [analyticsData] = useState({
7170
totalExecutions: 1247,
7271
executionTrend: '+12.5%',
7372
averageExecutionTime: '2.3s',
@@ -82,7 +81,6 @@ export default function BillingSettings() {
8281
useEffect(() => {
8382
if (!session?.user?.id) return
8483

85-
// Set up a timeout to prevent infinite loading
8684
const loadingTimeout = setTimeout(() => {
8785
if (isLoading) {
8886
console.warn('Billing data loading timeout, using defaults')
@@ -122,7 +120,7 @@ export default function BillingSettings() {
122120
{
123121
id: 'inv_001',
124122
date: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000).toISOString(),
125-
amount: 2000, // $20.00 in cents
123+
amount: 2000,
126124
status: 'paid',
127125
invoice_url: '#'
128126
},
@@ -152,7 +150,6 @@ export default function BillingSettings() {
152150

153151
loadBillingInfo()
154152

155-
// Cleanup timeout on unmount
156153
return () => {
157154
clearTimeout(loadingTimeout)
158155
}
@@ -161,8 +158,7 @@ export default function BillingSettings() {
161158
const handleUpgradePlan = async () => {
162159
setIsUpdating(true)
163160
try {
164-
165-
await new Promise(resolve => setTimeout(resolve, 2000)) // Simulate API call
161+
await new Promise(resolve => setTimeout(resolve, 2000))
166162

167163
toast({
168164
title: "Redirecting to Checkout",
@@ -187,8 +183,7 @@ export default function BillingSettings() {
187183

188184
setIsUpdating(true)
189185
try {
190-
191-
await new Promise(resolve => setTimeout(resolve, 1500)) // Simulate API call
186+
await new Promise(resolve => setTimeout(resolve, 1500))
192187

193188
if (billingInfo) {
194189
setBillingInfo({
@@ -219,8 +214,7 @@ export default function BillingSettings() {
219214
const handleUpdatePaymentMethod = async () => {
220215
setIsUpdating(true)
221216
try {
222-
223-
await new Promise(resolve => setTimeout(resolve, 1000)) // Simulate redirect
217+
await new Promise(resolve => setTimeout(resolve, 1000))
224218

225219
toast({
226220
title: "Redirecting to Payment Portal",

0 commit comments

Comments
 (0)