use "Remove" button in edit dialog
This commit is contained in:
@@ -58,6 +58,7 @@ export function WizardEditListDialog({
|
|||||||
state.currentStep === 'Profiles' ? (
|
state.currentStep === 'Profiles' ? (
|
||||||
<WizardProfileCard
|
<WizardProfileCard
|
||||||
profile={item}
|
profile={item}
|
||||||
|
btnType="remove"
|
||||||
state={state}
|
state={state}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
moderationOpts={moderationOpts}
|
moderationOpts={moderationOpts}
|
||||||
@@ -65,6 +66,7 @@ export function WizardEditListDialog({
|
|||||||
) : (
|
) : (
|
||||||
<WizardFeedCard
|
<WizardFeedCard
|
||||||
generator={item}
|
generator={item}
|
||||||
|
btnType="remove"
|
||||||
state={state}
|
state={state}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
moderationOpts={moderationOpts}
|
moderationOpts={moderationOpts}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
ModerationUI,
|
ModerationUI,
|
||||||
} from '@atproto/api'
|
} from '@atproto/api'
|
||||||
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
import {GeneratorView} from '@atproto/api/dist/client/types/app/bsky/feed/defs'
|
||||||
import {msg} from '@lingui/macro'
|
import {msg, Trans} from '@lingui/macro'
|
||||||
import {useLingui} from '@lingui/react'
|
import {useLingui} from '@lingui/react'
|
||||||
|
|
||||||
import {DISCOVER_FEED_URI} from 'lib/constants'
|
import {DISCOVER_FEED_URI} from 'lib/constants'
|
||||||
@@ -19,12 +19,14 @@ import {useSession} from 'state/session'
|
|||||||
import {UserAvatar} from 'view/com/util/UserAvatar'
|
import {UserAvatar} from 'view/com/util/UserAvatar'
|
||||||
import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State'
|
import {WizardAction, WizardState} from '#/screens/StarterPack/Wizard/State'
|
||||||
import {atoms as a, useTheme} from '#/alf'
|
import {atoms as a, useTheme} from '#/alf'
|
||||||
|
import {Button, ButtonText} from '#/components/Button'
|
||||||
import * as Toggle from '#/components/forms/Toggle'
|
import * as Toggle from '#/components/forms/Toggle'
|
||||||
import {Checkbox} from '#/components/forms/Toggle'
|
import {Checkbox} from '#/components/forms/Toggle'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
|
||||||
function WizardListCard({
|
function WizardListCard({
|
||||||
type,
|
type,
|
||||||
|
btnType,
|
||||||
displayName,
|
displayName,
|
||||||
subtitle,
|
subtitle,
|
||||||
onPress,
|
onPress,
|
||||||
@@ -34,6 +36,7 @@ function WizardListCard({
|
|||||||
moderationUi,
|
moderationUi,
|
||||||
}: {
|
}: {
|
||||||
type: 'user' | 'algo'
|
type: 'user' | 'algo'
|
||||||
|
btnType: 'checkbox' | 'remove'
|
||||||
profile?: AppBskyActorDefs.ProfileViewBasic
|
profile?: AppBskyActorDefs.ProfileViewBasic
|
||||||
feed?: AppBskyFeedDefs.GeneratorView
|
feed?: AppBskyFeedDefs.GeneratorView
|
||||||
displayName: string
|
displayName: string
|
||||||
@@ -56,7 +59,7 @@ function WizardListCard({
|
|||||||
: _(msg`Add ${displayName} to starter pack`)
|
: _(msg`Add ${displayName} to starter pack`)
|
||||||
}
|
}
|
||||||
value={included}
|
value={included}
|
||||||
disabled={disabled}
|
disabled={btnType === 'remove' || disabled}
|
||||||
onChange={onPress}
|
onChange={onPress}
|
||||||
style={[
|
style={[
|
||||||
a.flex_row,
|
a.flex_row,
|
||||||
@@ -85,17 +88,33 @@ function WizardListCard({
|
|||||||
{subtitle}
|
{subtitle}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
{btnType === 'checkbox' ? (
|
||||||
<Checkbox />
|
<Checkbox />
|
||||||
|
) : !disabled ? (
|
||||||
|
<Button
|
||||||
|
label={_(msg`Remove`)}
|
||||||
|
variant="solid"
|
||||||
|
color="secondary"
|
||||||
|
size="xsmall"
|
||||||
|
style={[a.self_center, {marginLeft: 'auto'}]}
|
||||||
|
onPress={onPress}>
|
||||||
|
<ButtonText>
|
||||||
|
<Trans>Remove</Trans>
|
||||||
|
</ButtonText>
|
||||||
|
</Button>
|
||||||
|
) : null}
|
||||||
</Toggle.Item>
|
</Toggle.Item>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function WizardProfileCard({
|
export function WizardProfileCard({
|
||||||
|
btnType,
|
||||||
state,
|
state,
|
||||||
dispatch,
|
dispatch,
|
||||||
profile,
|
profile,
|
||||||
moderationOpts,
|
moderationOpts,
|
||||||
}: {
|
}: {
|
||||||
|
btnType: 'checkbox' | 'remove'
|
||||||
state: WizardState
|
state: WizardState
|
||||||
dispatch: (action: WizardAction) => void
|
dispatch: (action: WizardAction) => void
|
||||||
profile: AppBskyActorDefs.ProfileViewBasic
|
profile: AppBskyActorDefs.ProfileViewBasic
|
||||||
@@ -127,6 +146,7 @@ export function WizardProfileCard({
|
|||||||
return (
|
return (
|
||||||
<WizardListCard
|
<WizardListCard
|
||||||
type="user"
|
type="user"
|
||||||
|
btnType={btnType}
|
||||||
displayName={displayName}
|
displayName={displayName}
|
||||||
subtitle={`@${sanitizeHandle(profile.handle)}`}
|
subtitle={`@${sanitizeHandle(profile.handle)}`}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
@@ -139,11 +159,13 @@ export function WizardProfileCard({
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function WizardFeedCard({
|
export function WizardFeedCard({
|
||||||
|
btnType,
|
||||||
generator,
|
generator,
|
||||||
state,
|
state,
|
||||||
dispatch,
|
dispatch,
|
||||||
moderationOpts,
|
moderationOpts,
|
||||||
}: {
|
}: {
|
||||||
|
btnType: 'checkbox' | 'remove'
|
||||||
generator: GeneratorView
|
generator: GeneratorView
|
||||||
state: WizardState
|
state: WizardState
|
||||||
dispatch: (action: WizardAction) => void
|
dispatch: (action: WizardAction) => void
|
||||||
@@ -170,6 +192,7 @@ export function WizardFeedCard({
|
|||||||
return (
|
return (
|
||||||
<WizardListCard
|
<WizardListCard
|
||||||
type="algo"
|
type="algo"
|
||||||
|
btnType={btnType}
|
||||||
displayName={sanitizeDisplayName(generator.displayName)}
|
displayName={sanitizeDisplayName(generator.displayName)}
|
||||||
subtitle={`Feed by @${sanitizeHandle(generator.creator.handle)}`}
|
subtitle={`Feed by @${sanitizeHandle(generator.creator.handle)}`}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export function StepFeeds({moderationOpts}: {moderationOpts: ModerationOpts}) {
|
|||||||
return (
|
return (
|
||||||
<WizardFeedCard
|
<WizardFeedCard
|
||||||
generator={item}
|
generator={item}
|
||||||
|
btnType="checkbox"
|
||||||
state={state}
|
state={state}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
moderationOpts={moderationOpts}
|
moderationOpts={moderationOpts}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ export function StepProfiles({
|
|||||||
return (
|
return (
|
||||||
<WizardProfileCard
|
<WizardProfileCard
|
||||||
profile={item}
|
profile={item}
|
||||||
|
btnType="checkbox"
|
||||||
state={state}
|
state={state}
|
||||||
dispatch={dispatch}
|
dispatch={dispatch}
|
||||||
moderationOpts={moderationOpts}
|
moderationOpts={moderationOpts}
|
||||||
|
|||||||
@@ -476,13 +476,10 @@ function Footer({
|
|||||||
</Trans>
|
</Trans>
|
||||||
) : items.length === 2 ? (
|
) : items.length === 2 ? (
|
||||||
<Trans>
|
<Trans>
|
||||||
<Text style={[a.font_bold, textStyles]}>
|
<Text style={[a.font_bold, textStyles]}>You</Text> and
|
||||||
{getName(items[initialNamesIndex])}{' '}
|
|
||||||
</Text>
|
|
||||||
and
|
|
||||||
<Text> </Text>
|
<Text> </Text>
|
||||||
<Text style={[a.font_bold, textStyles]}>
|
<Text style={[a.font_bold, textStyles]}>
|
||||||
{getName(items[state.currentStep === 'Profiles' ? 0 : 1])}{' '}
|
{getName(items[initialNamesIndex])}{' '}
|
||||||
</Text>
|
</Text>
|
||||||
are included in your starter pack
|
are included in your starter pack
|
||||||
</Trans>
|
</Trans>
|
||||||
|
|||||||
Reference in New Issue
Block a user