Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create admin page with ability to control featured communities #309

Closed
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
5e5fd99
chore: Format
carina-akaia Jul 20, 2023
0803e08
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 1, 2023
6b5d095
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 7, 2023
7a82065
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 9, 2023
a0f340f
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 11, 2023
d7a2a1b
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Aug 24, 2023
d4df7fd
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Sep 15, 2023
6dc15b5
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 13, 2023
ff072f3
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 16, 2023
2d24951
wip: Create admin page
carina-akaia Oct 16, 2023
ba5b11a
wip: Add navigation link to the admin page
carina-akaia Oct 16, 2023
6927299
wip
carina-akaia Oct 16, 2023
700058d
wip
carina-akaia Oct 18, 2023
1062edc
wip
carina-akaia Oct 18, 2023
e8871cb
wip
carina-akaia Oct 18, 2023
1000607
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 18, 2023
2747128
wip
carina-akaia Oct 19, 2023
0e4bce5
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 19, 2023
1866a1a
Apply permission control logic
carina-akaia Oct 19, 2023
c8d7cf2
Apply permission control logic
carina-akaia Oct 19, 2023
e8547fa
Apply post-QA amendments
carina-akaia Oct 20, 2023
7c6b814
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 23, 2023
eeb9719
chore: Format
carina-akaia Oct 24, 2023
49496e7
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 24, 2023
c18561d
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 26, 2023
2223b40
Merge branch 'main' into feature/275-featured-communities
elliotBraem Oct 30, 2023
2f6b36c
move changes to devhub directory
Tguntenaar Oct 31, 2023
62d0db1
fix: remove theori.near from account.context
Tguntenaar Oct 31, 2023
f5acf5d
Merge pull request #6 from Tguntenaar/feature/275-refactored
carina-akaia Oct 31, 2023
16f9a7d
wip
carina-akaia Oct 31, 2023
b66ed9e
wip: Create API binding for `set_featured_communities`
carina-akaia Oct 31, 2023
20ee610
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Oct 31, 2023
63c8abf
fix: Turn `useQuery` subscription back on
carina-akaia Oct 31, 2023
1381029
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Oct 31, 2023
0105f4d
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Nov 2, 2023
77145c6
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Nov 7, 2023
1fcfae0
Target `devhub.near` account with bos-loader
carina-akaia Nov 7, 2023
395ff08
wip: Declare admin route
carina-akaia Nov 7, 2023
0216f97
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Nov 8, 2023
4954fee
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Nov 9, 2023
699846c
Merge branch 'main' of https://github.com/near/neardevhub-widgets
carina-akaia Nov 9, 2023
2853f75
Fix widget account id for bos-loader
carina-akaia Nov 9, 2023
fb5dd92
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Nov 13, 2023
410f5ec
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Nov 15, 2023
d516433
Merge branches 'feature/275-featured-communities' and 'main' of https…
carina-akaia Nov 16, 2023
7afdd4b
Merge branch 'main' of https://github.com/near/neardevhub-widgets int…
carina-akaia Nov 16, 2023
9165063
Apply design amendments
carina-akaia Nov 16, 2023
c99ef8e
Rollback irrelevant changes
carina-akaia Nov 16, 2023
004af4d
Rollback irrelevant changes
carina-akaia Nov 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/gigs-board/components/molecule/button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ const styles = `
line-height: 1.5;
text-decoration: none !important;

&.vertical {
padding: 1.2rem 0.5rem !important;
}

&:not(.shadow-none) {
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
transition: box-shadow 0.6s;
Expand Down Expand Up @@ -241,7 +245,13 @@ const Button = ({
>
{Struct.typeMatch(iconProps) && widget("components.atom.icon", iconProps)}

<span className={classNames?.label} style={{ lineHeight: "inherit" }}>
<span
carina-akaia marked this conversation as resolved.
Show resolved Hide resolved
className={[
classNames?.label,
typeof label === "string" ? "" : "d-none",
].join(" ")}
style={{ lineHeight: "inherit" }}
>
{label}
</span>
</ButtonRoot>
Expand Down
18 changes: 11 additions & 7 deletions src/gigs-board/components/molecule/tile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ const AttractableImage = styled.img`
`;
/* END_INCLUDE: "core/lib/gui/attractable" */

const TileRoot = ({ children, noFrame, ...otherProps }) =>
noFrame ? (
<div {...otherProps}>{children}</div>
) : (
<AttractableDiv {...otherProps}>{children}</AttractableDiv>
);

const Tile = ({
children,
borderRadius,
Expand All @@ -42,7 +49,7 @@ const Tile = ({
minHeight,
style,
}) => (
<AttractableDiv
<TileRoot
carina-akaia marked this conversation as resolved.
Show resolved Hide resolved
className={[
"d-flex flex-column gap-3",
className,
Expand All @@ -58,16 +65,13 @@ const Tile = ({
height: "fit-content",
...style,
}}
{...{ id }}
{...{ id, noFrame }}
>
{
<div
className={[
"d-flex align-items-center justify-content-between gap-3",

noFrame || (!heading && !headingAdornment && !headerSlotRight)
? "d-none"
: "",
!heading && !headingAdornment && !headerSlotRight ? "d-none" : "",
].join(" ")}
style={{ minHeight: 30 }}
>
Expand All @@ -81,7 +85,7 @@ const Tile = ({
}

{children}
</AttractableDiv>
</TileRoot>
);

return Tile(props);
157 changes: 91 additions & 66 deletions src/gigs-board/components/organism/app-header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,75 +63,100 @@ const Header = styled.div`
}
`;

const AppHeader = ({ path }) => (
<Header className="d-flex justify-content-between align-items-center">
<div className="d-flex gap-2">
<a href={href("Feed")}>
<img src="https://ipfs.near.social/ipfs/bafkreibjsn3gswlcc5mvgkfv7ady2lzkd2htm55l472suarbd34qryh2uy"></img>
</a>

{widget("components.molecule.breadcrumbs", {
classNames: { link: "fs-5" },
path,
})}
</div>

<div className="d-flex align-items-center gap-3">
{!(path ?? []).some(({ pageId }) => pageId === "communities") ? (
<a href={href("communities")} class="text-white me-2">
const AppHeader = ({ path, viewer }) => {
console.log(JSON.stringify(viewer, undefined, 2));

return (
<Header className="d-flex justify-content-between align-items-center">
<div className="d-flex gap-2">
<a href={href("Feed")}>
<img src="https://ipfs.near.social/ipfs/bafkreibjsn3gswlcc5mvgkfv7ady2lzkd2htm55l472suarbd34qryh2uy"></img>
</a>

{widget("components.molecule.breadcrumbs", {
classNames: { link: "fs-5" },
path,
})}
</div>

<div className="d-flex align-items-center gap-3">
<a
className={[
"text-white me-2",

(path ?? []).some(({ pageId }) => pageId === "communities")
? "d-none"
: "",
].join(" ")}
href={href("communities")}
>
Communities
</a>
) : null}

<a
className="text-white"
href="https://www.neardevgov.org/blog/near-developer-dao"
target="_blank"
>
Developer DAO
</a>

<div className="btn-group" role="group">
<button
type="button"
className="btn btn-outline-light border-opacity-75 rounded-circle"
style={{
width: "30px",
height: "30px",
padding: "6px 0px",
borderWidth: "2px",
lineHeight: "0px",
}}
data-bs-toggle="dropdown"
aria-expanded="false"

<a
className={[
"text-white me-2",

!(path ?? []).some(({ pageId }) => pageId === "admin") &&
viewer.role.isDevHubModerator
? ""
: "d-none",
].join(" ")}
href={href("admin")}
>
Admin
</a>

<a
className="text-white"
href="https://www.neardevgov.org/blog/near-developer-dao"
target="_blank"
>
<i className="bi bi-question-lg"></i>
</button>

<ul className="dropdown-menu dropdown-menu-end">
<li>
<a
target="_blank"
className="dropdown-item"
href="https://github.com/near/devgigsboard-widgets/issues/new?assignees=&labels=bug&template=bug_report.md&title="
>
Report a bug
</a>
</li>

<li>
<a
target="_blank"
className="dropdown-item"
href="https://github.com/near/devgigsboard-widgets/issues/new?assignees=&labels=enhancement&template=feature-request.md&title="
>
Suggest an improvement
</a>
</li>
</ul>
Developer DAO
</a>

<div className="btn-group" role="group">
<button
type="button"
className="btn btn-outline-light border-opacity-75 rounded-circle"
style={{
width: "30px",
height: "30px",
padding: "6px 0px",
borderWidth: "2px",
lineHeight: "0px",
}}
data-bs-toggle="dropdown"
aria-expanded="false"
>
<i className="bi bi-question-lg"></i>
</button>

<ul className="dropdown-menu dropdown-menu-end">
<li>
<a
target="_blank"
className="dropdown-item"
href="https://github.com/near/devgigsboard-widgets/issues/new?assignees=&labels=bug&template=bug_report.md&title="
>
Report a bug
</a>
</li>

<li>
<a
target="_blank"
className="dropdown-item"
href="https://github.com/near/devgigsboard-widgets/issues/new?assignees=&labels=enhancement&template=feature-request.md&title="
>
Suggest an improvement
</a>
</li>
</ul>
</div>
</div>
</div>
</Header>
);
</Header>
);
};

return AppHeader(props);
24 changes: 18 additions & 6 deletions src/gigs-board/components/organism/configurator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,20 @@ const defaultFieldsRender = ({ schema, form, isEditable, isUnlocked }) => (
<>
{Object.entries(schema).map(
(
[key, { format, inputProps, noop, label, order, style, ...fieldProps }],
[
key,
{
format,
hints,
inputProps,
noop,
label,
order,
style,
title,
...fieldProps
},
],
idx
) => {
const fieldKey = `${idx}-${key}`,
Expand Down Expand Up @@ -314,10 +327,9 @@ const defaultFieldsRender = ({ schema, form, isEditable, isUnlocked }) => (
...(inputProps ?? {}),
disabled: isDisabled,

title:
noop ?? false
? "Temporarily disabled due to technical reasons."
: inputProps.title,
title: isDisabled
? hints.disabled
: hints.default ?? inputProps.title,

...(fieldParamsByType[fieldType].inputProps ?? {}),
tabIndex: order,
Expand Down Expand Up @@ -421,7 +433,7 @@ const Configurator = ({
<div className={`d-flex flex-column gap-${isActive ? 1 : 4}`}>
{fieldsRender({
form,
isEditable: isUnlocked && isActive,
isEditable: isActive,
isUnlocked,
schema,
})}
Expand Down
4 changes: 2 additions & 2 deletions src/gigs-board/components/template/app-layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ function href(widgetName, linkProps) {
}
/* END_INCLUDE: "common.jsx" */

const AppLayout = ({ banner, children, path }) => (
const AppLayout = ({ banner, children, path, viewer }) => (
<div className="d-flex flex-column w-100 h-100" style={{ minHeight: "86vh" }}>
{widget("components.organism.app-header", { path })}
{widget("components.organism.app-header", { path, viewer })}
{banner}
<div className="w-100 h-100">{children}</div>
</div>
Expand Down
21 changes: 13 additions & 8 deletions src/gigs-board/entity/community/card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ const AttractableImage = styled.img`
/* END_INCLUDE: "core/lib/gui/attractable" */

const CommunityCard = ({
actions,
format,
isBannerEnabled,
metadata,
Expand All @@ -92,12 +93,10 @@ const CommunityCard = ({
const link = href("community.activity", { handle: metadata.handle });

const formatSmall = (
<AttractableLink
<AttractableDiv
{...otherProps}
href={link}
className={[
"d-flex flex-shrink-0 p-3",
"rounded-4 border border-2",
"d-flex flex-shrink-0 gap-3 p-3 rounded-4 border border-2",
"text-black text-decoration-none",
].join(" ")}
style={{
Expand All @@ -110,8 +109,12 @@ const CommunityCard = ({
height: 110,
}}
>
<div
className="d-flex align-items-center gap-3 rounded-4 w-100 h-100"
<a
className={[
"d-flex align-items-center gap-3 rounded-4 w-100 h-100",
"text-dark text-decoration-none",
].join(" ")}
href={link}
style={{
background: "rgba(255, 255, 255, 0.9)",
backdropFilter: "blur(4px)",
Expand Down Expand Up @@ -140,8 +143,10 @@ const CommunityCard = ({
{metadata.description}
</p>
</div>
</div>
</AttractableLink>
</a>

{actions}
</AttractableDiv>
);

const formatMedium = (
Expand Down
Loading