Skip to content

Commit

Permalink
maintenance: remove colony objective widget from dashboard and colony…
Browse files Browse the repository at this point in the history
… details page
  • Loading branch information
rumzledz committed Aug 13, 2024
1 parent fd3c2bb commit 2344b79
Show file tree
Hide file tree
Showing 42 changed files with 122 additions and 718 deletions.
16 changes: 0 additions & 16 deletions scripts/create-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ const CHAR_LIMITS = {
},
COLONY: {
MAX_COLONY_DISPLAY_NAME: 20,
MAX_COLONY_OBJECTIVE_TITLE: 60,
MAX_COLONY_OBJECTIVE_DESCRIPTION: 200,
},
};

Expand Down Expand Up @@ -550,7 +548,6 @@ const createColony = async (
colonyDescription,
colonySocialLinks = [],
colonyAvatar,
colonyObjective = {},
version,
token: {
name: tokenName = 'Generic Token',
Expand Down Expand Up @@ -679,19 +676,6 @@ const createColony = async (
if (colonySocialLinks && colonySocialLinks.length) {
metadata.externalLinks = colonySocialLinks;
}
if (colonyObjective?.title && colonyObjective?.description) {
metadata.objective = {
...colonyObjective,
title: colonyObjective.title.slice(
0,
CHAR_LIMITS.COLONY.MAX_COLONY_OBJECTIVE_TITLE,
),
description: colonyObjective.description.slice(
0,
CHAR_LIMITS.COLONY.MAX_COLONY_OBJECTIVE_DESCRIPTION,
),
};
}

const colonyExists = await tryFetchGraphqlQuery(getColonyMetadata, {
id: utils.getAddress(colonyAddress),
Expand Down
188 changes: 73 additions & 115 deletions scripts/tempColonyData.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ const getMessageDescriptorKeys = (actionType: AnyActionType) => {
return [ActionTitleMessageKeys.ChainName];
case actionType.includes(ColonyActionType.CreateDecisionMotion):
return [ActionTitleMessageKeys.Initiator];
/**
* @deprecated
* This is still needed to allow users to view existing Colony Objectives Actions
*/
case actionType.includes(ExtendedColonyActionType.UpdateColonyObjective):
return [ActionTitleMessageKeys.Initiator];
case safeActionTypes.some((type) => actionType.includes(type)):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ export const ACTION_TYPES_FILTERS = [
// name: Action.EnterRecoveryMode,
// },
{
/**
* @deprecated
* This is still needed to allow users to filter the Activity Table by the Colony Objective Action type
*/
label: formatText({ id: 'actions.manageColonyObjectives' }),
name: Action.ManageColonyObjectives,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { type FC } from 'react';
import { defineMessages, useIntl } from 'react-intl';

import { Action } from '~constants/actions.ts';
import { MAX_OBJECTIVE_DESCRIPTION_LENGTH } from '~constants/index.ts';
import { MAX_COLONY_DESCRIPTION_LENGTH } from '~constants/index.ts';
import { useActionSidebarContext } from '~context/ActionSidebarContext/ActionSidebarContext.ts';
import { useColonyContext } from '~context/ColonyContext/ColonyContext.ts';
import { useSetPageHeadingTitle } from '~context/PageHeadingContext/PageHeadingContext.ts';
Expand All @@ -12,7 +12,6 @@ import { tw } from '~utils/css/index.ts';
import { multiLineTextEllipsis } from '~utils/strings.ts';
import { ACTION_TYPE_FIELD_NAME } from '~v5/common/ActionSidebar/consts.ts';
import NativeTokenPill from '~v5/common/NativeTokenPill/index.ts';
import ObjectiveBox from '~v5/common/ObjectiveBox/index.ts';
import Button from '~v5/shared/Button/index.ts';
import ColonyAvatar from '~v5/shared/ColonyAvatar/index.ts';
import CopyableAddress from '~v5/shared/CopyableAddress/index.ts';
Expand All @@ -26,19 +25,6 @@ const MSG = defineMessages({
defaultMessage:
'Enter a short description about your Colony’s main purpose.',
},
objectiveTitle: {
id: `${displayName}.objectiveTitle`,
defaultMessage: 'Current Colony Objective',
},
objectiveDescription: {
id: `${displayName}.objectiveDescription`,
defaultMessage:
'Colony objectives area the main goal or mission of the Colony all member’s are contributing towards. The objective appears on the main Dashboard of the Colony and progress of the goal is visible. {br} {br} Each update requires a motion progress or the correct Colony wide permissions.',
},
objectiveBoxTitle: {
id: `${displayName}.objectiveBoxTitle`,
defaultMessage: 'Current Colony objective:',
},
});

const ColonyDetailsPage: FC = () => {
Expand All @@ -58,7 +44,6 @@ const ColonyDetailsPage: FC = () => {
displayName: colonyDisplayName,
description,
externalLinks,
objective,
} = metadata || {};
const isNativeTokenLocked = !status?.nativeToken?.unlocked;

Expand Down Expand Up @@ -98,10 +83,7 @@ const ColonyDetailsPage: FC = () => {
})}
>
{description && description.length > 0
? multiLineTextEllipsis(
description,
MAX_OBJECTIVE_DESCRIPTION_LENGTH,
)
? multiLineTextEllipsis(description, MAX_COLONY_DESCRIPTION_LENGTH)
: formatMessage(MSG.descriptionPlaceholder)}
</p>
{externalLinks && externalLinks.length ? (
Expand All @@ -123,55 +105,6 @@ const ColonyDetailsPage: FC = () => {
}}
/>
</div>
<div
className={clsx(
'mt-6 flex flex-col items-start gap-6 p-6 sm:mt-9 sm:flex-row sm:gap-12',
boxClass,
)}
>
<div className="flex-1">
<h3 className="mb-4 heading-4">
{formatMessage(MSG.objectiveTitle)}
</h3>
<p className="text-md text-gray-600 sm:mb-6">
{formatMessage(MSG.objectiveDescription, { br: <br /> })}
</p>
{!isMobile && (
<Button
mode="primarySolid"
size="small"
text={{ id: 'button.manageObjective' }}
textValues={{ existing: !!objective?.title }}
onClick={() => {
toggleActionSidebarOn({
[ACTION_TYPE_FIELD_NAME]: Action.ManageColonyObjectives,
});
}}
/>
)}
</div>
<div className="w-full sm:max-w-[20.375rem]">
<h5 className="mb-2 text-3">
{formatMessage(MSG.objectiveBoxTitle)}
</h5>
<ObjectiveBox objective={objective} />
</div>
{isMobile && (
// @TODO: Test functionality to create objective on mobile
<Button
mode="primarySolid"
size="small"
text={{ id: 'button.manageObjective' }}
textValues={{ existing: !!objective?.title }}
isFullSize
onClick={() => {
toggleActionSidebarOn({
[ACTION_TYPE_FIELD_NAME]: Action.ManageColonyObjectives,
});
}}
/>
)}
</div>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export const getPermissionsNeededForAction = (
return [ColonyRole.Administration];
}
case Action.EditColonyDetails:
case Action.ManageColonyObjectives:
return [ColonyRole.Root];
case Action.UpgradeColonyVersion:
return [ColonyRole.Root];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ const useActionsList = () => {
// label: { id: 'actions.enterRecoveryMode' },
// value: Action.EnterRecoveryMode,
// },
{
label: { id: 'actions.manageColonyObjectives' },
value: Action.ManageColonyObjectives,
},
// {
// label: { id: 'actions.createNewIntegration' },
// value: Action.CreateNewIntegration,
Expand Down
18 changes: 1 addition & 17 deletions src/components/v5/common/ActionSidebar/hooks/useGetActionData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Action } from '~constants/actions.ts';
import { getRole, UserRole } from '~constants/permissions.ts';
import { ColonyActionType } from '~gql';
import { convertRolesToArray } from '~transformers/index.ts';
import { DecisionMethod, ExtendedColonyActionType } from '~types/actions.ts';
import { DecisionMethod } from '~types/actions.ts';
import { getExtendedActionType } from '~utils/colonyActions.ts';
import {
getSelectedToken,
Expand Down Expand Up @@ -143,22 +143,6 @@ const useGetActionData = (transactionId: string | undefined) => {
recipient: recipientAddress,
...repeatableFields,
};
case ExtendedColonyActionType.UpdateColonyObjective:
return {
[ACTION_TYPE_FIELD_NAME]: Action.ManageColonyObjectives,
colonyName: colony?.metadata?.displayName,
colonyAvatar: colony.metadata?.avatar || colony.metadata?.thumbnail,
colonyObjectiveTitle: isMotion
? pendingColonyMetadata?.objective?.title
: colony.metadata?.objective?.title,
colonyObjectiveDescription: isMotion
? pendingColonyMetadata?.objective?.description
: colony.metadata?.objective?.description,
colonyObjectiveProgress: isMotion
? pendingColonyMetadata?.objective?.progress
: colony.metadata?.objective?.progress,
...repeatableFields,
};
case ColonyActionType.ColonyEdit:
case ColonyActionType.ColonyEditMotion: {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import CreateNewTeamForm from '../partials/forms/CreateNewTeamForm/index.ts';
import EditColonyDetailsForm from '../partials/forms/EditColonyDetailsForm/index.ts';
import EditTeamForm from '../partials/forms/EditTeamForm/index.ts';
import EnterRecoveryModeForm from '../partials/forms/EnterRecoveryModeForm/index.ts';
import ManageColonyObjectivesForm from '../partials/forms/ManageColonyObjectivesForm/index.ts';
import ManagePermissionsForm from '../partials/forms/ManagePermissionsForm/index.ts';
import ManageReputationForm from '../partials/forms/ManageReputationForm/index.ts';
import ManageTokensForm from '../partials/forms/ManageTokensForm/ManageTokensForm.tsx';
Expand Down Expand Up @@ -39,7 +38,6 @@ const useSidebarActionForm = () => {
[Action.EditExistingTeam]: EditTeamForm,
[Action.EnterRecoveryMode]: EnterRecoveryModeForm,
[Action.EditColonyDetails]: EditColonyDetailsForm,
[Action.ManageColonyObjectives]: ManageColonyObjectivesForm,
[Action.SplitPayment]: SplitPaymentForm,
[Action.ManageTokens]: ManageTokensForm,
[Action.PaymentBuilder]: PaymentBuilderForm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import CreateNewDomainDescription from './partials/CreateNewDomainDescription.ts
import EditColonyDetailsDescription from './partials/EditColonyDetailsDescription.tsx';
import EditDomainDescription from './partials/EditDomainDescription.tsx';
import EnterRecoveryModeDescription from './partials/EnterRecoveryModeDescription.tsx';
import ManageColonyObjectiveDescription from './partials/ManageColonyObjectiveDescription.tsx';
import ManagePermissionsDescription from './partials/ManagePermissionsDescription.tsx';
import ManageReputationDescription from './partials/ManageReputationDescription.tsx';
import ManageTokensDescription from './partials/ManageTokensDescription.tsx';
Expand Down Expand Up @@ -42,8 +41,6 @@ const ActionSidebarDescription = () => {
return <EditDomainDescription />;
case Action.EnterRecoveryMode:
return <EnterRecoveryModeDescription />;
case Action.ManageColonyObjectives:
return <ManageColonyObjectiveDescription />;
case Action.ManagePermissions:
return <ManagePermissionsDescription />;
case Action.ManageTokens:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { type FC } from 'react';

import {
MAX_COLONY_DISPLAY_NAME,
MAX_OBJECTIVE_DESCRIPTION_LENGTH,
MAX_COLONY_DESCRIPTION_LENGTH,
} from '~constants/index.ts';
import { formatText } from '~utils/intl.ts';
import ActionFormRow from '~v5/common/ActionFormRow/index.ts';
Expand Down Expand Up @@ -86,7 +86,7 @@ const ColonyDetailsFields: FC = () => {
>
<FormTextareaBase
message={false}
maxLength={MAX_OBJECTIVE_DESCRIPTION_LENGTH}
maxLength={MAX_COLONY_DESCRIPTION_LENGTH}
name="colonyDescription"
placeholder={formatText({
id: 'actionSidebar.colonyDescription.placeholder',
Expand Down
Loading

0 comments on commit 2344b79

Please sign in to comment.