Ver código fonte

Add worker and opening ids, rename "My roles", fix typos

Leszek Wiesner 4 anos atrás
pai
commit
d0a66801ff

+ 1 - 1
pioneer/packages/apps/public/locales/en/ui.json

@@ -632,7 +632,7 @@
   "My Requests": "",
   "Working groups": "",
   "Opportunities": "",
-  "My roles": "",
+  "My roles and applications": "",
   "My channels": "",
   "New channel": "",
   "My videos": "",

+ 1 - 1
pioneer/packages/joy-proposals/src/forms/GenericWorkingGroupProposalForm.tsx

@@ -83,7 +83,7 @@ export const GenericWorkingGroupProposalForm: React.FunctionComponent<FormInnerP
           name="workingGroup"
           placeholder="Select the working group"
           selection
-          options={Object.keys(WorkingGroupDef).map(wgKey => ({ text: wgKey + ' Wroking Group', value: wgKey }))}
+          options={Object.keys(WorkingGroupDef).map(wgKey => ({ text: wgKey + ' Working Group', value: wgKey }))}
           value={values.workingGroup}
           onChange={ handleChange }
         />

+ 13 - 0
pioneer/packages/joy-roles/src/elements.tsx

@@ -10,6 +10,7 @@ import { IProfile, MemberId } from '@joystream/types/members';
 import { GenericAccountId } from '@polkadot/types';
 import { LeadRoleState } from '@joystream/types/content-working-group';
 import { WorkerId } from '@joystream/types/working-group';
+import { WorkingGroups } from './working_groups';
 
 type BalanceProps = {
   balance?: Balance;
@@ -39,6 +40,8 @@ export function HandleView (props: ProfileProps) {
 
 export type GroupMember = {
   memberId: MemberId;
+  group: WorkingGroups;
+  workerId: number;
   roleAccount: GenericAccountId;
   profile: IProfile;
   title: string;
@@ -78,6 +81,11 @@ export function GroupLeadView (props: GroupLead & inset) {
         </Image>
         <Card.Header><HandleView profile={props.profile} /></Card.Header>
         <Card.Meta>{props.title}</Card.Meta>
+        <Card.Meta>
+          { props.workerId && (
+            <Label size="tiny">{ 'Worker ID: ' + props.workerId.toString() }</Label>
+          ) }
+        </Card.Meta>
         <Card.Description>
           <Label color='teal' ribbon={fluid}>
             <Icon name="shield" />
@@ -134,6 +142,11 @@ export function GroupMemberView (props: GroupMember & inset) {
         </Image>
         <Card.Header><HandleView profile={props.profile} /></Card.Header>
         <Card.Meta>{props.title}</Card.Meta>
+        <Card.Meta>
+          <Label size="tiny">
+            { (props.group === WorkingGroups.ContentCurators ? 'Curator' : 'Worker') + ` ID: ${props.workerId.toString()}` }
+          </Label>
+        </Card.Meta>
         <Card.Description>
           {stake}
         </Card.Description>

+ 1 - 1
pioneer/packages/joy-roles/src/flows/apply.tsx

@@ -950,7 +950,7 @@ export function DoneStage (props: DoneStageProps) {
       </p>
       <p>
         You can track the progress of your
-        application in the <Link to="#working-group/my-roles">My roles</Link> section. Note that your application is attached
+        application in the <Link to="#working-group/my-roles">My roles and applications</Link> section. Note that your application is attached
         to your role key (see below).  If you have any issues, you can message the group lead in in the <Link to="#forum">Forum</Link> or contact them directly.
       </p>
 

+ 1 - 1
pioneer/packages/joy-roles/src/index.tsx

@@ -73,7 +73,7 @@ export const App: React.FC<Props> = (props: Props) => {
   if (props.myAddress) {
     tabs.push({
       name: 'my-roles',
-      text: t('My roles')
+      text: t('My roles and applications')
     });
   }
 

+ 1 - 1
pioneer/packages/joy-roles/src/tabs.stories.tsx

@@ -27,7 +27,7 @@ export const RolesPage = () => {
   const panes = [
     { menuItem: 'Working groups', render: renderWorkingGroups },
     { menuItem: 'Opportunities', render: renderOpportunitySandbox },
-    { menuItem: 'My roles', render: renderMyRolesSandbox }
+    { menuItem: 'My roles and applications', render: renderMyRolesSandbox }
   ];
 
   return (

+ 4 - 1
pioneer/packages/joy-roles/src/tabs/Opportunities.tsx

@@ -89,6 +89,9 @@ export function OpeningHeader (props: OpeningStage) {
               />
             </Link>
           </Label.Detail>
+          <Label.Detail>
+            <Icon name="hashtag" /> {props.meta.id}
+          </Label.Detail>
         </Label>
         <a>
           <CopyToClipboard text={window.location.origin + '/#/working-groups/opportunities/' + props.meta.group + '/' + props.meta.id}>
@@ -540,7 +543,7 @@ export const OpeningsView = Loadable<OpeningsViewProps>(
     };
     const groupOption = (group: WorkingGroups | null, lead = false) => ({
       value: `${basePath}${group ? `/${group}` : ''}${lead ? '/lead' : ''}`,
-      text: _.startCase(`${group || 'All opportuniries'}`) + (lead ? ' (Lead)' : '')
+      text: _.startCase(`${group || 'All opportunities'}`) + (lead ? ' (Lead)' : '')
     });
     // Can assert "props.openings!" because we're using "Loadable" which prevents them from beeing undefined
     const filteredOpenings = props.openings!.filter(o =>

+ 16 - 5
pioneer/packages/joy-roles/src/tabs/WorkingGroup.stories.tsx

@@ -12,6 +12,7 @@ import { mockProfile } from '../mocks';
 
 import 'semantic-ui-css/semantic.min.css';
 import '@polkadot/joy-roles/index.sass';
+import { WorkingGroups } from '../working_groups';
 
 export default {
   title: 'Roles / Components / Working groups tab',
@@ -29,7 +30,9 @@ export function ContentCuratorsSection () {
       ),
       title: text('Title', 'Curation lead', 'Ben'),
       stake: new u128(number('Stake', 10101, {}, 'Ben')),
-      earned: new u128(number('Earned', 347829, {}, 'Ben'))
+      earned: new u128(number('Earned', 347829, {}, 'Ben')),
+      workerId: 1,
+      group: WorkingGroups.ContentCurators
     },
     {
       memberId: new MemberId(2),
@@ -37,7 +40,9 @@ export function ContentCuratorsSection () {
       profile: mockProfile(text('Handle', 'bwhm0', 'Martin')),
       title: text('Title', 'Content curator', 'Martin'),
       stake: new u128(number('Stake', 10101, {}, 'Martin')),
-      earned: new u128(number('Earned', 347829, {}, 'Martin'))
+      earned: new u128(number('Earned', 347829, {}, 'Martin')),
+      workerId: 2,
+      group: WorkingGroups.ContentCurators
     },
     {
       memberId: new MemberId(3),
@@ -48,7 +53,9 @@ export function ContentCuratorsSection () {
       ),
       title: text('Title', 'Content curator', 'Paul'),
       stake: new u128(number('Stake', 10101, {}, 'Paul')),
-      earned: new u128(number('Earned', 347829, {}, 'Paul'))
+      earned: new u128(number('Earned', 347829, {}, 'Paul')),
+      workerId: 3,
+      group: WorkingGroups.ContentCurators
     },
     {
       memberId: new MemberId(4),
@@ -59,7 +66,9 @@ export function ContentCuratorsSection () {
       ),
       title: text('Title', 'Content curator', 'Alex'),
       stake: new u128(number('Stake', 10101, {}, 'Alex')),
-      earned: new u128(number('Earned', 347829, {}, 'Alex'))
+      earned: new u128(number('Earned', 347829, {}, 'Alex')),
+      workerId: 4,
+      group: WorkingGroups.ContentCurators
     },
     {
       memberId: new MemberId(5),
@@ -70,7 +79,9 @@ export function ContentCuratorsSection () {
       ),
       title: text('Title', 'Content curator', 'Mokhtar'),
       stake: new u128(number('Stake', 10101, {}, 'Mokhtar')),
-      earned: new u128(number('Earned', 347829, {}, 'Mokhtar'))
+      earned: new u128(number('Earned', 347829, {}, 'Mokhtar')),
+      workerId: 5,
+      group: WorkingGroups.ContentCurators
     }
   ];
 

+ 18 - 6
pioneer/packages/joy-roles/src/transport.mock.ts

@@ -65,7 +65,9 @@ export class Transport extends TransportBase implements ITransport {
           ),
           title: 'Content curator',
           stake: new u128(10101),
-          earned: new u128(347829)
+          earned: new u128(347829),
+          workerId: 1,
+          group: WorkingGroups.ContentCurators
         },
         {
           memberId: new MemberId(2),
@@ -73,7 +75,9 @@ export class Transport extends TransportBase implements ITransport {
           profile: mockProfile('bwhm0'),
           title: 'Content curator',
           stake: new u128(10101),
-          earned: new u128(347829)
+          earned: new u128(347829),
+          workerId: 2,
+          group: WorkingGroups.ContentCurators
         },
         {
           memberId: new MemberId(3),
@@ -84,7 +88,9 @@ export class Transport extends TransportBase implements ITransport {
           ),
           title: 'Content curator',
           stake: new u128(10101),
-          earned: new u128(347829)
+          earned: new u128(347829),
+          workerId: 3,
+          group: WorkingGroups.ContentCurators
         },
         {
           memberId: new MemberId(4),
@@ -95,7 +101,9 @@ export class Transport extends TransportBase implements ITransport {
           ),
           title: 'Content curator',
           stake: new u128(10101),
-          earned: new u128(347829)
+          earned: new u128(347829),
+          workerId: 4,
+          group: WorkingGroups.ContentCurators
         },
         {
           memberId: new MemberId(3),
@@ -106,7 +114,9 @@ export class Transport extends TransportBase implements ITransport {
           ),
           title: 'Content curator',
           stake: new u128(10101),
-          earned: new u128(347829)
+          earned: new u128(347829),
+          workerId: 5,
+          group: WorkingGroups.ContentCurators
         }
       ]
     });
@@ -127,7 +137,9 @@ export class Transport extends TransportBase implements ITransport {
           ),
           title: 'Storage provider',
           stake: new u128(10101),
-          earned: new u128(347829)
+          earned: new u128(347829),
+          workerId: 1,
+          group: WorkingGroups.StorageProviders
         }
       ]
     });

+ 2 - 0
pioneer/packages/joy-roles/src/transport.substrate.ts

@@ -259,7 +259,9 @@ export class Transport extends TransportBase implements ITransport {
 
     return ({
       roleAccount,
+      group,
       memberId,
+      workerId: id.toNumber(),
       profile: profile.unwrap(),
       title: workerRoleNameByGroup[group],
       stake: stakeValue,