Skip to content

Commit

Permalink
Merge pull request #53 from iluxonchik/feature/govbot-0.0.21
Browse files Browse the repository at this point in the history
Feature/govbot 0.0.21
  • Loading branch information
iluxonchik authored Oct 11, 2024
2 parents 58a4675 + 045587b commit e4b7f82
Show file tree
Hide file tree
Showing 15 changed files with 2,223 additions and 2,101 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mina-govbot",
"version": "0.0.19",
"version": "0.0.21",
"description": "Discord bot for collective decision making for Mina Protocol",
"main": "index.js",
"directories": {
Expand Down
20 changes: 13 additions & 7 deletions src/channels/admin/screens/AdminHomeScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,34 @@ export class AdminHomeScreen extends Screen implements IHomeScreen {
.setTitle('🛠️ Admin Dashboard')
.setDescription('Welcome to the Admin Dashboard. Please select a category to manage:')
.addFields(
{ name: '👥 SME Management', value: 'Manage SME Groups and Users' },
{ name: '📋 Topic Management', value: 'Manage Topics and Committees' },
{ name: '💰 Funding Round Management', value: 'Manage Funding Rounds and Phases' },
{ name: '👥 Manage Reviewers', value: 'Manage Reviewers and Users' },
{ name: '📋 Manage Discussion Topics', value: 'Manage Discussion Topics and Committees' },
{ name: '💰 Manage Funding Rounds', value: 'Manage Funding Rounds and Phases' },
{ name: '📊 Manage Proposal Status', value: 'Set/Override Proposal Status' },
{ name: '🗳️ Count Votes', value: 'Count Votes for a Funding Round.' },
);
}

private createActionRow(): ActionRowBuilder<ButtonBuilder> {
return new ActionRowBuilder<ButtonBuilder>().addComponents(
new ButtonBuilder()
.setCustomId(this.manageSMEGroupsScreen.fullCustomId)
.setLabel('SME Management')
.setLabel('Manage Reviewers ')
.setStyle(ButtonStyle.Primary)
.setEmoji('👥'),
new ButtonBuilder().setCustomId(this.manageTopicsScreen.fullCustomId).setLabel('Topic Management').setStyle(ButtonStyle.Primary).setEmoji('📋'),
new ButtonBuilder()
.setCustomId(this.manageTopicsScreen.fullCustomId)
.setLabel('Manage Discussion Topics')
.setStyle(ButtonStyle.Primary)
.setEmoji('📋'),
new ButtonBuilder()
.setCustomId(this.manageFundingRoundsScreen.fullCustomId)
.setLabel('Funding Round Management')
.setLabel('Manage Funding Rounds')
.setStyle(ButtonStyle.Primary)
.setEmoji('💰'),
new ButtonBuilder()
.setCustomId(this.manageProposalStatusesScreen.fullCustomId)
.setLabel('Proposal Status Management')
.setLabel('Manage Proposal Status')
.setStyle(ButtonStyle.Primary)
.setEmoji('📊'),
new ButtonBuilder().setCustomId(this.countVotesScreen.fullCustomId).setLabel('Count Votes').setStyle(ButtonStyle.Primary).setEmoji('🗳️'),
Expand Down
64 changes: 60 additions & 4 deletions src/channels/admin/screens/ManageFundingRoundsScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { FundingRoundMI, FundingRoundMIPhaseValue } from '../../../models/Interf
import { InputDate } from '../../../dates/Input';
import {
ApproveRejectFundingRoundPaginator,
EditAllFundingRoundsPaginator,
EditFundingRoundPaginator,
FundingRoundPaginator,
RemoveCommiteeFundingRoundPaginator,
Expand All @@ -40,6 +41,7 @@ export class ManageFundingRoundsScreen extends Screen {

public readonly createFundingRoundAction: CreateOrEditFundingRoundAction;
public readonly modifyFundingRoundAction: ModifyFundingRoundAction;
public readonly modifyAllFundingRoundsAction: ModifyAllFundingRoundsAction;
public readonly setFundingRoundCommitteeAction: SetFundingRoundCommitteeAction;
public readonly removeFundingRoundCommitteeAction: RemoveFundingRoundCommitteeAction;
public readonly approveFundingRoundAction: ApproveFundingRoundAction;
Expand All @@ -54,6 +56,7 @@ export class ManageFundingRoundsScreen extends Screen {
public readonly selectForumChannelAction: SelectForumChannelAction;

public readonly crudFRPaginatorAction: EditFundingRoundPaginator;
public readonly crudAllFRPaginatorAction: EditAllFundingRoundsPaginator;
public readonly committeeFRPaginator: SetCommitteeFundingRoundPaginator;
public readonly committeeDeleteFRPaginator: RemoveCommiteeFundingRoundPaginator;
public readonly approveRejectFRPaginator: ApproveRejectFundingRoundPaginator;
Expand All @@ -62,6 +65,7 @@ export class ManageFundingRoundsScreen extends Screen {
super(dashboard, screenId);
this.createFundingRoundAction = new CreateOrEditFundingRoundAction(this, CreateOrEditFundingRoundAction.ID);
this.modifyFundingRoundAction = new ModifyFundingRoundAction(this, ModifyFundingRoundAction.ID);
this.modifyAllFundingRoundsAction = new ModifyAllFundingRoundsAction(this, ModifyAllFundingRoundsAction.ID);
this.setFundingRoundCommitteeAction = new SetFundingRoundCommitteeAction(this, SetFundingRoundCommitteeAction.ID);
this.removeFundingRoundCommitteeAction = new RemoveFundingRoundCommitteeAction(this, RemoveFundingRoundCommitteeAction.ID);
this.approveFundingRoundAction = new ApproveFundingRoundAction(this, ApproveFundingRoundAction.ID);
Expand All @@ -82,6 +86,12 @@ export class ManageFundingRoundsScreen extends Screen {
CreateOrEditFundingRoundAction.OPERATIONS.SHOW_PROGRESS,
EditFundingRoundPaginator.ID,
);
this.crudAllFRPaginatorAction = new EditAllFundingRoundsPaginator(
this,
this.createFundingRoundAction,
CreateOrEditFundingRoundAction.OPERATIONS.SHOW_PROGRESS,
EditAllFundingRoundsPaginator.ID,
);
this.committeeFRPaginator = new SetCommitteeFundingRoundPaginator(
this,
this.setFundingRoundCommitteeAction,
Expand Down Expand Up @@ -110,6 +120,7 @@ export class ManageFundingRoundsScreen extends Screen {
return [
this.createFundingRoundAction,
this.modifyFundingRoundAction,
this.modifyAllFundingRoundsAction,
this.setFundingRoundCommitteeAction,
this.removeFundingRoundCommitteeAction,
this.approveFundingRoundAction,
Expand All @@ -124,6 +135,7 @@ export class ManageFundingRoundsScreen extends Screen {
this.selectForumChannelAction,

this.crudFRPaginatorAction,
this.crudAllFRPaginatorAction,
];
}

Expand All @@ -134,7 +146,7 @@ export class ManageFundingRoundsScreen extends Screen {
.setDescription('Select an action to manage funding rounds:');

const createButton = this.createFundingRoundAction.getComponent();
const modifyButton = this.modifyFundingRoundAction.getComponent();
const modifyButton = this.modifyAllFundingRoundsAction.getComponent();
const addCommitteeButton = this.setFundingRoundCommitteeAction.getComponent();
const removeCommitteeButton = this.removeFundingRoundCommitteeAction.getComponent();
const approveButton = this.approveFundingRoundAction.getComponent();
Expand Down Expand Up @@ -996,7 +1008,7 @@ export class ModifyFundingRoundAction extends Action {
public static readonly ID = 'modifyFundingRound';

public static readonly OPERATIONS = {
SHOW_FUNDING_ROUNDS: 'showFundingRounds',
SHOW_FUNDING_ROUNDS: 'shFR',
};

constructor(screen: Screen, actionId: string) {
Expand Down Expand Up @@ -1036,6 +1048,50 @@ export class ModifyFundingRoundAction extends Action {
}
}

export class ModifyAllFundingRoundsAction extends Action {
public static readonly ID = 'modAllFR';

public static readonly OPERATIONS = {
SHOW_FUNDING_ROUNDS: 'shFR',
};

constructor(screen: Screen, actionId: string) {
super(screen, actionId);
}

protected async handleOperation(interaction: TrackedInteraction, operationId: string): Promise<void> {
switch (operationId) {
case ModifyFundingRoundAction.OPERATIONS.SHOW_FUNDING_ROUNDS:
await this.handleShowFundingRounds(interaction);
break;
default:
await this.handleInvalidOperation(interaction, operationId);
}
}

private async handleShowFundingRounds(interaction: TrackedInteraction): Promise<void> {
await (this.screen as ManageFundingRoundsScreen).crudAllFRPaginatorAction.handlePagination(interaction);
}

public allSubActions(): Action[] {
return [];
}

getComponent(): ButtonBuilder {
return new ButtonBuilder()
.setCustomId(
CustomIDOracle.addArgumentsToAction(
this,
ModifyFundingRoundAction.OPERATIONS.SHOW_FUNDING_ROUNDS,
FundingRoundPaginator.BOOLEAN.ARGUMENTS.FORCE_REPLY,
FundingRoundPaginator.BOOLEAN.TRUE,
),
)
.setLabel('Edit Funding Round')
.setStyle(ButtonStyle.Primary);
}
}

export class SetFundingRoundCommitteeAction extends PaginationComponent {
public static readonly ID = 'setFundingRoundCommittee';

Expand Down Expand Up @@ -1229,7 +1285,7 @@ export class SetFundingRoundCommitteeAction extends PaginationComponent {
.setColor('#FF0000')
.setTitle(`Incomplete Committe Selection For ${fundingRound.name}`)
.setDescription(
`New Members Added: ${numCreatedRecords}. The selected members do not meet the requirements for each SME group. Please add them.`,
`New Members Added: ${numCreatedRecords}. The selected members do not meet the requirements for each Reviewer group. Please add them.`,
);

for (const committee of topicCommittees) {
Expand Down Expand Up @@ -1258,7 +1314,7 @@ export class SetFundingRoundCommitteeAction extends PaginationComponent {
.setColor('#00FF00')
.setTitle(`Full Committee Selected For ${fundingRound.name}`)
.setDescription(
`New members assigned: ${numCreatedRecords}. Assinged Funding Round deliberation phase committee members meet the requirements for each SME group.`,
`New members assigned: ${numCreatedRecords}. Assinged Funding Round deliberation phase committee members meet the requirements for each Reviewer group.`,
);

for (const committee of topicCommittees) {
Expand Down
1 change: 1 addition & 0 deletions src/channels/admin/screens/ManageProposalStatusesScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { ActiveFundingRoundPaginator } from '../../../components/FundingRoundPag
import { ManageProposalStatusesPaginator } from '../../../components/ProposalsPaginator';
import { ArgumentOracle } from '../../../CustomIDOracle';
import { DiscordLimiter } from '../../../utils/DiscordLimiter';
import logger from '../../../logging';

export class ManageProposalStatusesScreen extends Screen {
public static readonly ID = 'manageProposalStatuses';
Expand Down
Loading

0 comments on commit e4b7f82

Please sign in to comment.