Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make stake button for creators go directly to the related stakers #150

Merged
merged 2 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/spaces/SpaceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function SpaceCard({ spaceId, ...props }: SpaceCardProps) {
subtitle={<DfMd className='ColorCurrentColor' source={spaceData?.content?.about} />}
buttons={
spaceData && [
<StakeButton key={'stake'} spaceId={spaceData.id} />,
<StakeButton key={'stake'} spaceStruct={spaceData.struct} />,
isMySpace ? (
<ButtonLink
href={'/[spaceId]/edit'}
Expand Down
17 changes: 11 additions & 6 deletions src/components/spaces/ViewSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import React, { MouseEvent, useCallback, useState } from 'react'
import { ButtonLink } from 'src/components/utils/CustomLinks'
import { Segment } from 'src/components/utils/Segment'
import { LARGE_AVATAR_SIZE } from 'src/config/Size.config'
import { SpaceContent, SpaceId, SpaceWithSomeDetails } from 'src/types'
import { SpaceContent, SpaceId, SpaceStruct, SpaceWithSomeDetails } from 'src/types'
import config from '../../config'
import { useSelectProfileSpace } from '../../rtk/features/profiles/profilesHooks'
import { useSelectSpace } from '../../rtk/features/spaces/spacesHooks'
import { useMyAddress } from '../auth/MyAccountsContext'
import MakeAsProfileModal from '../profiles/address-views/utils/MakeAsProfileModal'
import { useIsMobileWidthOrDevice } from '../responsive'
import { editSpaceUrl } from '../urls'
import { editSpaceUrl, spaceUrl } from '../urls'
import { DfMd } from '../utils/DfMd'
import { EntityStatusGroup, PendingSpaceOwnershipPanel } from '../utils/EntityStatusPanels'
import { SummarizeMd } from '../utils/md'
Expand Down Expand Up @@ -59,9 +59,14 @@ export const SpaceNameAsLink = React.memo(({ space, ...props }: SpaceNameAsLinkP
return <ViewSpaceLink space={space.struct} title={spaceName} {...props} />
})

export const StakeButton = ({ spaceId }: { spaceId: SpaceId }) => {
return config.creatorIds?.includes(spaceId) ? (
<ButtonLink type='primary' href={'https://sub.id/creators'} className={clsx('mr-2')}>
export const StakeButton = ({ spaceStruct }: { spaceStruct: SpaceStruct }) => {
return config.creatorIds?.includes(spaceStruct.id) ? (
<ButtonLink
type='primary'
target='_blank'
href={`https://sub.id/creators/${spaceUrl(spaceStruct)}`}
className={clsx('mr-2')}
>
Stake
</ButtonLink>
) : null
Expand Down Expand Up @@ -196,7 +201,7 @@ export const InnerViewSpace = (props: Props) => {
<EditOutlined /> Edit
</ButtonLink>
) : (
withStakeButton && <StakeButton spaceId={space.id} />
withStakeButton && <StakeButton spaceStruct={space} />
))}

{withFollowButton && <FollowSpaceButton space={space} />}
Expand Down
18 changes: 17 additions & 1 deletion src/config/app/polkaverse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,23 @@ const index: AppConfig = {
claimedSpaceIds: ['1', '2', '3', '4', '5'],
recommendedSpaceIds: polkaverseSpaces,
suggestedTlds: ['sub', 'polka'],
creatorIds: ['11414', '4809', '4777', '6953', '10132', '6283', '11581', '7366', '11157', '11566'],
creatorIds: [
'11414',
'4809',
'4777',
'6953',
'10132',
'6283',
'11581',
'7366',
'11157',
'11566',
'10124',
'11581',
'1573',
'1238',
'11844',
],
}

export default index