@@ -144,97 +144,99 @@ export function DiscoverForm({ type }: { type: string }) {
144
144
{ mutation . data ?. length > 1 && "s" }
145
145
</ div >
146
146
< div className = "space-y-6 text-sm" >
147
- { mutation . data ?. map ( ( item ) => (
148
- < Card
149
- data-feed-id = { item . feed . id }
150
- key = { item . feed . url || item . docs }
151
- className = "select-text"
152
- >
153
- < CardHeader >
154
- < FollowSummary className = "max-w-[462px]" feed = { item . feed } docs = { item . docs } />
155
- </ CardHeader >
156
- { item . docs ? (
157
- < CardFooter >
158
- < a href = { item . docs } target = "_blank" rel = "noreferrer" >
159
- < Button > View Docs</ Button >
160
- </ a >
161
- </ CardFooter >
162
- ) : (
163
- < >
164
- < CardContent >
165
- { ! ! item . entries ?. length && (
166
- < div className = "grid grid-cols-4 gap-4" >
167
- { item . entries
168
- . filter ( ( e ) => ! ! e )
169
- . map ( ( entry ) => {
170
- const assertEntry = entry
171
- return (
172
- < a
173
- key = { assertEntry . id }
174
- href = { assertEntry . url || void 0 }
175
- target = "_blank"
176
- className = "flex min-w-0 flex-1 flex-col items-center gap-1"
177
- rel = "noreferrer"
178
- >
179
- { assertEntry . media ?. [ 0 ] ? (
180
- < Media
181
- src = { assertEntry . media ?. [ 0 ] . url }
182
- type = { assertEntry . media ?. [ 0 ] . type }
183
- previewImageUrl = { assertEntry . media ?. [ 0 ] . preview_image_url }
184
- className = "aspect-square w-full"
185
- />
186
- ) : (
187
- < div className = "flex aspect-square w-full overflow-hidden rounded bg-stone-100 p-2 text-xs leading-tight text-zinc-500" >
147
+ { mutation . data
148
+ ?. sort ( ( a , b ) => ( b . subscriptionCount ?? 0 ) - ( a . subscriptionCount ?? 0 ) )
149
+ . map ( ( item ) => (
150
+ < Card
151
+ data-feed-id = { item . feed . id }
152
+ key = { item . feed . url || item . docs }
153
+ className = "select-text"
154
+ >
155
+ < CardHeader >
156
+ < FollowSummary className = "max-w-[462px]" feed = { item . feed } docs = { item . docs } />
157
+ </ CardHeader >
158
+ { item . docs ? (
159
+ < CardFooter >
160
+ < a href = { item . docs } target = "_blank" rel = "noreferrer" >
161
+ < Button > View Docs</ Button >
162
+ </ a >
163
+ </ CardFooter >
164
+ ) : (
165
+ < >
166
+ < CardContent >
167
+ { ! ! item . entries ?. length && (
168
+ < div className = "grid grid-cols-4 gap-4" >
169
+ { item . entries
170
+ . filter ( ( e ) => ! ! e )
171
+ . map ( ( entry ) => {
172
+ const assertEntry = entry
173
+ return (
174
+ < a
175
+ key = { assertEntry . id }
176
+ href = { assertEntry . url || void 0 }
177
+ target = "_blank"
178
+ className = "flex min-w-0 flex-1 flex-col items-center gap-1"
179
+ rel = "noreferrer"
180
+ >
181
+ { assertEntry . media ?. [ 0 ] ? (
182
+ < Media
183
+ src = { assertEntry . media ?. [ 0 ] . url }
184
+ type = { assertEntry . media ?. [ 0 ] . type }
185
+ previewImageUrl = { assertEntry . media ?. [ 0 ] . preview_image_url }
186
+ className = "aspect-square w-full"
187
+ />
188
+ ) : (
189
+ < div className = "flex aspect-square w-full overflow-hidden rounded bg-stone-100 p-2 text-xs leading-tight text-zinc-500" >
190
+ { assertEntry . title }
191
+ </ div >
192
+ ) }
193
+ < div className = "line-clamp-2 w-full text-xs leading-tight" >
188
194
{ assertEntry . title }
189
195
</ div >
190
- ) }
191
- < div className = "line-clamp-2 w-full text-xs leading-tight" >
192
- { assertEntry . title }
193
- </ div >
194
- </ a >
195
- )
196
- } ) }
196
+ </ a >
197
+ )
198
+ } ) }
199
+ </ div >
200
+ ) }
201
+ </ CardContent >
202
+ < CardFooter >
203
+ { item . isSubscribed ? (
204
+ < Button variant = "outline" disabled >
205
+ Followed
206
+ </ Button >
207
+ ) : (
208
+ < Button
209
+ onClick = { ( ) => {
210
+ present ( {
211
+ title : "Add Feed" ,
212
+ content : ( { dismiss } ) => (
213
+ < FeedForm
214
+ asWidget
215
+ url = { item . feed . url }
216
+ id = { item . feed . id }
217
+ defaultValues = { {
218
+ view : getSidebarActiveView ( ) . toString ( ) ,
219
+ } }
220
+ onSuccess = { dismiss }
221
+ />
222
+ ) ,
223
+ } )
224
+ } }
225
+ >
226
+ Follow
227
+ </ Button >
228
+ ) }
229
+ < div className = "ml-6 text-zinc-500" >
230
+ < span className = "font-medium text-zinc-800 dark:text-zinc-200" >
231
+ { item . subscriptionCount }
232
+ </ span > { " " }
233
+ Followers
197
234
</ div >
198
- ) }
199
- </ CardContent >
200
- < CardFooter >
201
- { item . isSubscribed ? (
202
- < Button variant = "outline" disabled >
203
- Followed
204
- </ Button >
205
- ) : (
206
- < Button
207
- onClick = { ( ) => {
208
- present ( {
209
- title : "Add Feed" ,
210
- content : ( { dismiss } ) => (
211
- < FeedForm
212
- asWidget
213
- url = { item . feed . url }
214
- id = { item . feed . id }
215
- defaultValues = { {
216
- view : getSidebarActiveView ( ) . toString ( ) ,
217
- } }
218
- onSuccess = { dismiss }
219
- />
220
- ) ,
221
- } )
222
- } }
223
- >
224
- Follow
225
- </ Button >
226
- ) }
227
- < div className = "ml-6 text-zinc-500" >
228
- < span className = "font-medium text-zinc-800 dark:text-zinc-200" >
229
- { item . subscriptionCount }
230
- </ span > { " " }
231
- Followers
232
- </ div >
233
- </ CardFooter >
234
- </ >
235
- ) }
236
- </ Card >
237
- ) ) }
235
+ </ CardFooter >
236
+ </ >
237
+ ) }
238
+ </ Card >
239
+ ) ) }
238
240
</ div >
239
241
</ div >
240
242
) }
0 commit comments