Show featured to all users

This commit is contained in:
Pico2x 2022-10-12 17:44:43 +01:00
parent 12ed569ff6
commit b49264ddfa
2 changed files with 12 additions and 7 deletions

View File

@ -230,7 +230,7 @@ export function PinnedItems(props: {
return pinned.length > 0 || isEditable ? (
<div>
<Row className="mb-3 items-center justify-between">
<Row className=" items-center justify-between">
<SectionHeader label={'Featured'} href={`#`} />
{isEditable && (
<Button
@ -265,7 +265,7 @@ export function PinnedItems(props: {
</div>
)}
{pinned.map((element, index) => (
<div className="relative my-2">
<div className="relative mb-4">
{element}
{editMode && <CrossIcon onClick={() => onDeleteClicked(index)} />}

View File

@ -275,9 +275,13 @@ function renderSections(
}
if (id === 'featured') {
// For now, only admins can see the featured section, until we all agree its ship-ready
if (!isAdmin) return <></>
return <FeaturedSection globalConfig={globalConfig} pinned={pinned} />
return (
<FeaturedSection
globalConfig={globalConfig}
pinned={pinned}
isAdmin={isAdmin}
/>
)
}
const contracts = sectionContracts[id]
@ -396,8 +400,9 @@ function SearchSection(props: {
function FeaturedSection(props: {
globalConfig: GlobalConfig
pinned: JSX.Element[]
isAdmin: boolean
}) {
const { globalConfig, pinned } = props
const { globalConfig, pinned, isAdmin } = props
const posts = useAllPosts()
async function onSubmit(selectedItems: { itemId: string; type: string }[]) {
@ -422,7 +427,7 @@ function FeaturedSection(props: {
<Col>
<PinnedItems
posts={posts}
isEditable={true}
isEditable={isAdmin}
pinned={pinned}
onDeleteClicked={onDeleteClicked}
onSubmit={onSubmit}