/* INCLUDE: "common.jsx" */ const nearDevGovGigsContractAccountId = props.nearDevGovGigsContractAccountId || (context.widgetSrc ?? "devgovgigs.near").split("/", 1)[0]; const nearDevGovGigsWidgetsAccountId = props.nearDevGovGigsWidgetsAccountId || (context.widgetSrc ?? "devgovgigs.near").split("/", 1)[0]; /** * Reads a board config from DevHub contract storage. * Currently a mock. * * Boards are indexed by their ids. */ const boardConfigByBoardId = ({ boardId }) => { return { probablyUUIDv4: { id: "probablyUUIDv4", columns: [ { title: "Draft", labelFilters: ["S-draft"] }, { title: "Review", labelFilters: ["S-review"] }, ], dataTypes: { Issue: true, PullRequest: true }, description: "Latest NEAR Enhancement Proposals by status", repoURL: "https://github.com/near/NEPs", title: "NEAR Protocol NEPs", }, }[boardId]; }; function widget(widgetName, widgetProps, key) { widgetProps = { ...widgetProps, nearDevGovGigsContractAccountId: props.nearDevGovGigsContractAccountId, nearDevGovGigsWidgetsAccountId: props.nearDevGovGigsWidgetsAccountId, referral: props.referral, }; return ( <Widget src={`${nearDevGovGigsWidgetsAccountId}/widget/gigs-board.${widgetName}`} props={widgetProps} key={key} /> ); } function href(widgetName, linkProps) { linkProps = { ...linkProps }; if (props.nearDevGovGigsContractAccountId) { linkProps.nearDevGovGigsContractAccountId = props.nearDevGovGigsContractAccountId; } if (props.nearDevGovGigsWidgetsAccountId) { linkProps.nearDevGovGigsWidgetsAccountId = props.nearDevGovGigsWidgetsAccountId; } if (props.referral) { linkProps.referral = props.referral; } const linkPropsQuery = Object.entries(linkProps) .map(([key, value]) => (value === null ? null : `${key}=${value}`)) .filter((nullable) => nullable !== null) .join("&"); return `/#/${nearDevGovGigsWidgetsAccountId}/widget/gigs-board.pages.${widgetName}${ linkPropsQuery ? "?" : "" }${linkPropsQuery}`; } const CompactContainer = styled.div` width: fit-content !important; max-width: 100%; `; const FormCheckLabel = styled.label` white-space: nowrap; `; /* END_INCLUDE: "common.jsx" */ const Header = styled.div` { height: 204px; overflow: hidden; background: #f3f3f3; padding: 10px 0; margin-top: -25px; margin-bottom: 25px; padding-left: 32px; } `; const NavUnderline = styled.ul` a { color: #3252a6; text-decoration: none; } a.active { font-weight: bold; border-bottom: 2px solid #0c7283; } `; const BreadcrumbLink = styled.a` { color: #3252a6; text-decoration: none; } `; const BreadcrumbBold = styled.b` { color: #3252a6; } `; const { label, tab } = props; const topicTabs = [ { contentProps: { label }, defaultActive: true, iconClass: "bi-house-door", path: "community.Overview", title: "Overview", }, { contentProps: { label }, iconClass: "bi-chat-square-text", path: "community.Discussions", title: "Discussions", }, { contentProps: { label }, iconClass: "bi-kanban", path: "community.Sponsorship", title: "Sponsorship", }, { contentProps: { label }, iconClass: "bi-calendar", path: "community.Events", title: "Events", }, { contentProps: { boardId: null, // communityById("communityId").boards[0].id label, // communities["communityId"].name }, iconClass: "bi-github", path: "community.GithubActivity", title: "GitHub board", // communityById("communityId").boards[0].title }, ]; // TODO nav-underline is available in bootstrap: https://getbootstrap.com/docs/5.3/components/navs-tabs/#underline, // but it's not there in near social, need write such style here return ( <Header> <div aria-label="breadcrumb"> <ol class="breadcrumb"> <li class="breadcrumb-item"> <BreadcrumbLink href={href("Feed")}>DevHub</BreadcrumbLink> </li> <li class="breadcrumb-item active" aria-current="page"> <BreadcrumbBold>{props.title}</BreadcrumbBold> </li> </ol> </div> <div class="d-flex flex-row align-items-center pb-3"> <img src={props.icon} width="95px" height="95px"></img> <div> <div class="h5 pt-3 ps-3">{props.title}</div> <div class="ps-3 pb-2 text-secondary">{props.desc}</div> </div> </div> <div> <NavUnderline className="nav"> {topicTabs.map( ({ contentProps, defaultActive, iconClass, path, title }, topicIdx) => title ? ( <li class="nav-item"> <a aria-current={defaultActive && "page"} className={tab === title ? "nav-link active" : "nav-link"} href={href(path, contentProps)} > {iconClass && <i class={iconClass} />} {title} </a> </li> ) : null )} </NavUnderline> </div> </Header> );