Skip to content

Commit 75f0ee8

Browse files
authored
Tweaks to add to starter pack dialog (#8957)
1 parent 5ce4aa5 commit 75f0ee8

File tree

1 file changed

+4
-17
lines changed

1 file changed

+4
-17
lines changed

src/components/dialogs/StarterPackDialog.tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export function StarterPackDialog({
7878
<Dialog.Outer control={control}>
7979
<Dialog.Handle />
8080
<StarterPackList
81-
control={control}
8281
onStartWizard={wrappedNavToWizard}
8382
targetDid={targetDid}
8483
enabled={enabled}
@@ -122,21 +121,19 @@ function Empty({onStartWizard}: {onStartWizard: () => void}) {
122121
}
123122

124123
function StarterPackList({
125-
control,
126124
onStartWizard,
127125
targetDid,
128126
enabled,
129127
}: {
130-
control: Dialog.DialogControlProps
131128
onStartWizard: () => void
132129
targetDid: string
133130
enabled?: boolean
134131
}) {
132+
const control = Dialog.useDialogContext()
135133
const {_} = useLingui()
136134

137135
const {
138136
data,
139-
refetch,
140137
isError,
141138
isLoading,
142139
hasNextPage,
@@ -147,15 +144,7 @@ function StarterPackList({
147144
const membershipItems =
148145
data?.pages.flatMap(page => page.starterPacksWithMembership) || []
149146

150-
const _onRefresh = useCallback(async () => {
151-
try {
152-
await refetch()
153-
} catch (err) {
154-
// Error handling is optional since this is just a refresh
155-
}
156-
}, [refetch])
157-
158-
const _onEndReached = useCallback(async () => {
147+
const onEndReached = useCallback(async () => {
159148
if (isFetchingNextPage || !hasNextPage || isError) return
160149
try {
161150
await fetchNextPage()
@@ -239,9 +228,7 @@ function StarterPackList({
239228
? () => 'starter_pack_dialog_loader'
240229
: (item: StarterPackWithMembership) => item.starterPack.uri
241230
}
242-
refreshing={false}
243-
onRefresh={_onRefresh}
244-
onEndReached={_onEndReached}
231+
onEndReached={onEndReached}
245232
onEndReachedThreshold={0.1}
246233
ListHeaderComponent={listHeader}
247234
ListEmptyComponent={<Empty onStartWizard={onStartWizard} />}
@@ -382,7 +369,7 @@ function StarterPackItem({
382369

383370
<Button
384371
label={isInPack ? _(msg`Remove`) : _(msg`Add`)}
385-
color={isInPack ? 'secondary' : 'primary'}
372+
color={isInPack ? 'secondary' : 'primary_subtle'}
386373
size="tiny"
387374
disabled={isPendingRefresh}
388375
onPress={handleToggleMembership}>

0 commit comments

Comments
 (0)