Skip to content

Commit 4d7b28d

Browse files
committed
cleanup
1 parent 264e4d8 commit 4d7b28d

File tree

10 files changed

+60
-313
lines changed

10 files changed

+60
-313
lines changed

src/components/RedirectVersionBanner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useLocalStorage } from '~/utils/useLocalStorage'
2-
import { useClientOnlyRender } from '~/utils/useClientOnlyRender'
2+
import { useMounted } from '~/hooks/useMounted'
33
import { Link, useMatches } from '@tanstack/react-router'
44

55
export function RedirectVersionBanner(props: {
@@ -18,7 +18,7 @@ export function RedirectVersionBanner(props: {
1818
1000 * 60 * 24 * 30,
1919
)
2020

21-
if (!useClientOnlyRender()) {
21+
if (!useMounted()) {
2222
return null
2323
}
2424

src/components/SearchModal.tsx

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -355,23 +355,18 @@ const Hit = ({
355355
</p>
356356
) : null}
357357
</div>
358-
{(() => {
359-
// Only show the badge on the right if we ARE filtered to a framework
360-
if (!refinedFramework || !hitFramework) return null
361-
362-
return (
363-
<div className="flex-none">
364-
<div className="flex items-center gap-1 text-xs font-black bg-white rounded-xl px-2 py-1 dark:bg-black">
365-
<img
366-
src={hitFramework.logo}
367-
alt={hitFramework.label}
368-
className="w-4"
369-
/>
370-
{capitalize(hitFramework.label)}
371-
</div>
358+
{refinedFramework && hitFramework ? (
359+
<div className="flex-none">
360+
<div className="flex items-center gap-1 text-xs font-black bg-white rounded-xl px-2 py-1 dark:bg-black">
361+
<img
362+
src={hitFramework.logo}
363+
alt={hitFramework.label}
364+
className="w-4"
365+
/>
366+
{capitalize(hitFramework.label)}
372367
</div>
373-
)
374-
})()}
368+
</div>
369+
) : null}
375370
</article>
376371
</SafeLink>
377372
)

src/routes/__root.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,11 @@ import { ToastProvider } from '~/components/ToastProvider'
2323
import { Spinner } from '~/components/Spinner'
2424
import { ThemeProvider } from '~/components/ThemeProvider'
2525
import { Navbar } from '~/components/Navbar'
26-
27-
// import { LibrariesLayout } from './_libraries/route'
2826
import { THEME_COLORS } from '~/utils/utils'
2927
import { useHubSpotChat } from '~/hooks/useHubSpotChat'
30-
// import { getCurrentUser } from '~/utils/auth.server'
3128

3229
export const Route = createRootRouteWithContext<{
3330
queryClient: QueryClient
34-
// user?: Awaited<ReturnType<typeof getCurrentUser>>
3531
}>()({
3632
head: () => ({
3733
meta: [
@@ -129,9 +125,7 @@ export const Route = createRootRouteWithContext<{
129125
notFoundComponent: () => {
130126
return (
131127
<DocumentWrapper>
132-
{/* <LibrariesLayout> */}
133128
<NotFound />
134-
{/* </LibrariesLayout> */}
135129
</DocumentWrapper>
136130
)
137131
},

src/routes/admin/users.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ function UsersPage() {
173173
const [editingUserId, setEditingUserId] = useState<string | null>(null)
174174
const [editingCapabilities, setEditingCapabilities] = useState<string[]>([])
175175
const [editingRoleIds, setEditingRoleIds] = useState<string[]>([])
176-
const [updatingAdsUserId] = useState<string | null>(null)
177176
const [selectedUserIds, setSelectedUserIds] = useState<Set<string>>(new Set())
178177
const [bulkActionRoleId, setBulkActionRoleId] = useState<string | null>(null)
179178
const [expandedSections, setExpandedSections] = useState<
@@ -844,7 +843,6 @@ function UsersPage() {
844843
onChange={(e) =>
845844
handleToggleAdsDisabled(user._id, e.target.checked)
846845
}
847-
disabled={updatingAdsUserId === user._id}
848846
className="h-4 w-4 accent-blue-600"
849847
/>
850848
)
@@ -911,7 +909,6 @@ function UsersPage() {
911909
toggleCapability,
912910
toggleRole,
913911
handleToggleAdsDisabled,
914-
updatingAdsUserId,
915912
allRoles,
916913
selectedUserIds,
917914
toggleUserSelection,

src/stores/userSettings.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,17 @@
11
import { create } from 'zustand'
2-
// Remove persist and createJSONStorage imports since we no longer use localStorage
3-
// import { persist, createJSONStorage } from 'zustand/middleware'
4-
// Remove the useCurrentUserQuery import since we'll use the new hook
5-
// import { useCurrentUserQuery } from '~/hooks/useCurrentUser'
62

7-
// Update the export to use the new hook
83
export { useAdsPreference } from '~/hooks/useAdPreference'
94

10-
export type UserSettings = {
11-
// Other settings can be added here in the future
12-
}
5+
export type UserSettings = {}
136

147
type UserSettingsState = {
158
settings: UserSettings
169
hasHydrated: boolean
1710
setHasHydrated: (value: boolean) => void
18-
// Remove toggleAds since it's now handled by the new hooks
1911
}
2012

2113
export const useUserSettingsStore = create<UserSettingsState>()((set) => ({
22-
settings: {
23-
// Remove adsDisabled initialization
24-
},
25-
hasHydrated: true, // No need for hydration since we're not using persistence
14+
settings: {},
15+
hasHydrated: true,
2616
setHasHydrated: (value) => set({ hasHydrated: value }),
27-
// Remove toggleAds function
2817
}))
29-
30-
// Remove the persist wrapper and localStorage configuration
31-
// The useAdsPreference function is now exported from useAdPreference.ts

src/styles/app.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,6 @@ mark {
618618
@apply fill-gray-800/90 stroke-gray-500/20;
619619
}
620620

621-
/* svg g[aria-label='crosshair text'] {
622-
stroke: none;
623-
} */
624-
625621
@font-face {
626622
font-display: swap;
627623
font-family: 'Inter';

src/utils/docs.ts

Lines changed: 0 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,15 @@ import { notFound } from '@tanstack/react-router'
88
import { createServerFn } from '@tanstack/react-start'
99
import { z } from 'zod'
1010
import { setResponseHeader } from '@tanstack/react-start/server'
11-
// import {
12-
// getContributorStats,
13-
// getContributorStatsForLibrary,
14-
// getBatchContributorStats,
15-
// type ContributorStats,
16-
// } from '~/server/github'
1711

1812
export const loadDocs = async ({
1913
repo,
2014
branch,
21-
// currentPath,
22-
// redirectPath,
2315
docsPath,
2416
}: {
2517
repo: string
2618
branch: string
2719
docsPath: string
28-
currentPath: string
29-
redirectPath: string
3020
}) => {
3121
if (!branch || !docsPath) {
3222
throw notFound({
@@ -43,8 +33,6 @@ export const loadDocs = async ({
4333
repo,
4434
branch,
4535
filePath,
46-
// currentPath,
47-
// redirectPath,
4836
},
4937
})
5038
}
@@ -58,15 +46,6 @@ export const fetchDocs = createServerFn({ method: 'GET' })
5846

5947
if (!file) {
6048
throw notFound()
61-
// if (currentPath === redirectPath) {
62-
// // console.log('not found')
63-
// throw notFound()
64-
// } else {
65-
// // console.log('redirect')
66-
// throw redirect({
67-
// to: redirectPath,
68-
// })
69-
// }
7049
}
7150

7251
const frontMatter = extractFrontMatter(file)
@@ -134,86 +113,3 @@ export const fetchRepoDirectoryContents = createServerFn({
134113

135114
return githubContents
136115
})
137-
138-
// GitHub contribution stats server functions - commented out due to performance/accuracy concerns
139-
/*
140-
export const fetchContributorStats = createServerFn({ method: 'GET' })
141-
.inputValidator(z.object({ username: z.string() }))
142-
.handler(async ({ data: { username } }) => {
143-
const stats = await getContributorStats(username)
144-
145-
// Cache for 30 minutes on shared cache
146-
// Revalidate in the background
147-
setResponseHeader('Cache-Control', 'public, max-age=0, must-revalidate')
148-
setResponseHeader(
149-
'CDN-Cache-Control',
150-
'max-age=1800, stale-while-revalidate=1800, durable'
151-
)
152-
153-
return stats
154-
})
155-
156-
export const fetchContributorStatsForLibrary = createServerFn({ method: 'GET' })
157-
.inputValidator(
158-
z.object({
159-
username: z.string(),
160-
libraryRepo: z.string(),
161-
})
162-
)
163-
.handler(async ({ data: { username, libraryRepo } }) => {
164-
const stats = await getContributorStatsForLibrary(username, libraryRepo)
165-
166-
// Cache for 30 minutes on shared cache
167-
// Revalidate in the background
168-
setResponseHeader('Cache-Control', 'public, max-age=0, must-revalidate')
169-
setResponseHeader(
170-
'CDN-Cache-Control',
171-
'max-age=1800, stale-while-revalidate=1800, durable'
172-
)
173-
174-
return stats
175-
})
176-
177-
export const fetchBatchContributorStats = createServerFn({ method: 'GET' })
178-
.inputValidator(z.object({ usernames: z.array(z.string()) }))
179-
.handler(async ({ data: { usernames } }) => {
180-
const stats = await getBatchContributorStats(usernames)
181-
182-
// Cache for 30 minutes on shared cache
183-
// Revalidate in the background
184-
setResponseHeader('Cache-Control', 'public, max-age=0, must-revalidate')
185-
setResponseHeader(
186-
'CDN-Cache-Control',
187-
'max-age=1800, stale-while-revalidate=1800, durable'
188-
)
189-
190-
return stats
191-
})
192-
193-
// Helper function to get stats for all maintainers
194-
export const fetchAllMaintainerStats = createServerFn({
195-
method: 'GET',
196-
}).handler(async () => {
197-
try {
198-
// Import maintainers data
199-
const { allMaintainers } = await import('~/libraries/maintainers')
200-
201-
const usernames = allMaintainers.map((maintainer) => maintainer.github)
202-
const stats = await getBatchContributorStats(usernames)
203-
204-
// Cache for 30 minutes on shared cache
205-
// Revalidate in the background
206-
setResponseHeader('Cache-Control', 'public, max-age=0, must-revalidate')
207-
setResponseHeader(
208-
'CDN-Cache-Control',
209-
'max-age=1800, stale-while-revalidate=1800, durable'
210-
)
211-
212-
return stats
213-
} catch (error) {
214-
console.error('Error fetching all maintainer stats:', error)
215-
// Return empty array if there's an error
216-
return []
217-
}
218-
})
219-
*/

0 commit comments

Comments
 (0)