// @flow import React, { useState } from 'react'; import { isNameValid } from 'lbry-redux'; import Button from 'component/button'; import { Form, FormField } from 'component/common/form'; export const DEFAULT_BID_FOR_FIRST_CHANNEL = 0.9; type Props = { createChannel: (string, number) => void, creatingChannel: boolean, createChannelError: string, claimingReward: boolean, user: User, }; function UserFirstChannel(props: Props) { const { createChannel, creatingChannel, claimingReward, user, createChannelError } = props; const { primary_email: primaryEmail } = user; const initialChannel = primaryEmail.split('@')[0]; const [channel, setChannel] = useState(initialChannel); const [nameError, setNameError] = useState(undefined); function handleCreateChannel() { createChannel(`@${channel}`, DEFAULT_BID_FOR_FIRST_CHANNEL); } function handleChannelChange(e) { const { value } = e.target; setChannel(value); if (!isNameValid(value, false)) { setNameError(__('LBRY names cannot contain spaces or reserved symbols ($#@;/"<>%{}|^~[]`)')); } else { setNameError(); } } return (

{__('Create A Channel')}

{__('A channel is your identity on the LBRY network.')}

{__('You can have more than one or change this later.')}

@
); } export default UserFirstChannel;