Skip to content

Commit 45c4118

Browse files
authored
Set spaces inactive and disable new proposal from UI, #1283 (#1284)
* Set inactive spaces, #1283 * refactor, #1283
1 parent 06a1559 commit 45c4118

3 files changed

Lines changed: 81 additions & 10 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
require("dotenv").config();
2+
3+
const { getSpaceCollection } = require("../mongo");
4+
5+
const spaceIds = [
6+
"interlay",
7+
"kintsugi",
8+
"centrifuge",
9+
"zeitgeist",
10+
"stafi",
11+
"stellaswap",
12+
"crust",
13+
"basilisk",
14+
"rmrk",
15+
"rmrk-curation",
16+
];
17+
18+
async function main() {
19+
const col = await getSpaceCollection();
20+
const result = await col.updateMany(
21+
{ id: { $in: spaceIds } },
22+
{ $set: { inactive: true } },
23+
);
24+
console.log(`Updated ${result.modifiedCount} spaces to inactive status`);
25+
}
26+
27+
main()
28+
.catch(console.error)
29+
.finally(() => process.exit());

next/components/listTab.js

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useSelector } from "react-redux";
1010
import { loginAccountSelector } from "store/reducers/accountSlice";
1111
import { isAdmin } from "frontedUtils/admin";
1212
import { ReactComponent as SettingsSVG } from "../public/imgs/icons/setting.svg";
13+
import { ReactComponent as AddSVG } from "../public/imgs/icons/add.svg";
1314

1415
const Wrapper = styled(FlexBetween)`
1516
align-items: flex-start;
@@ -65,6 +66,18 @@ const NewPostLink = styled(Flex)`
6566
}
6667
`;
6768

69+
const NewPostLinkDisabled = styled(Flex)`
70+
cursor: not-allowed;
71+
${p_16_semibold};
72+
color: var(--textQuaternary);
73+
> .img-div {
74+
display: inline-flex;
75+
width: 24px;
76+
height: 24px;
77+
margin-right: 8px;
78+
}
79+
`;
80+
6881
export default function ListTab({
6982
spaceId,
7083
space,
@@ -155,14 +168,25 @@ export default function ListTab({
155168
<div className="flex items-center gap-[16px] ml-[32px]">
156169
{settings}
157170

158-
<a href={`/space/${spaceId}/create`}>
159-
<NewPostLink>
160-
<div className="img-div">
161-
<img src="/imgs/icons/add.svg" alt="" />
162-
</div>
163-
New Proposal
164-
</NewPostLink>
165-
</a>
171+
{space?.inactive ? (
172+
<Tooltip content="This space is inactive">
173+
<NewPostLinkDisabled>
174+
<div className="img-div [&_svg_path]:fill-textQuaternary">
175+
<AddSVG width={24} height={24} />
176+
</div>
177+
New Proposal
178+
</NewPostLinkDisabled>
179+
</Tooltip>
180+
) : (
181+
<a href={`/space/${spaceId}/create`}>
182+
<NewPostLink>
183+
<div className="img-div">
184+
<AddSVG width={24} height={24} />
185+
</div>
186+
New Proposal
187+
</NewPostLink>
188+
</a>
189+
)}
166190
</div>
167191
</Wrapper>
168192
);

next/components/spaceListItem/index.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ const ActiveCircle = styled.div`
5959
margin-right: 8px;
6060
`;
6161

62+
const InactiveCircle = styled.div`
63+
${makeSquare(6)};
64+
border-radius: 50%;
65+
background-color: var(--textTertiary);
66+
margin-right: 8px;
67+
`;
68+
6269
const Count = styled.span`
6370
margin-left: auto;
6471
`;
@@ -140,8 +147,19 @@ export default function SpaceListItem({ name, space }) {
140147
</IconWrapper>
141148
<Divider />
142149
<ActiveWrapper>
143-
<ActiveCircle />
144-
<InternalLink href={`/space/${name}?tab=active`}>Active</InternalLink>
150+
{space.inactive ? (
151+
<>
152+
<InactiveCircle />
153+
<span>Inactive</span>
154+
</>
155+
) : (
156+
<>
157+
<ActiveCircle />
158+
<InternalLink href={`/space/${name}?tab=active`}>
159+
Active
160+
</InternalLink>
161+
</>
162+
)}
145163
<Count>
146164
<ActiveCount>{space.activeProposalsCount ?? 0}</ActiveCount>/
147165
{space.proposalsCount}

0 commit comments

Comments
 (0)