Skip to content

Commit

Permalink
community: added verified icon and parent
Browse files Browse the repository at this point in the history
  • Loading branch information
0einstein0 committed Oct 17, 2024
1 parent 88ec8b1 commit d6b3e39
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,23 @@
/>
</div>
<div class="page-subheader-element">
<a
href="{{ url_for('invenio_app_rdm_communities.communities_detail', pid_value=community.slug) }}"> {{ community.metadata.title }}</a>
<div class="ui header">
<a
href="{{ url_for('invenio_app_rdm_communities.communities_detail', pid_value=community.slug) }}" class="ui small header">
{{ community.metadata.title }}
</a>
{% if community.is_verified %}
<p class="ml-2 mb-0 display-inline-block"><i class="green check circle outline icon"></i></p>
{% endif %}
{% if community.parent %}
<div class="sub header">Part of
<a
href="{{ url_for('invenio_app_rdm_communities.communities_home', pid_value=community.parent.slug) }}">
{{community.parent.metadata.title}}
</a>
</div>
{% endif %}
</div>
{% if is_community_restricted %}
<span
class="ui label horizontal small access-status restricted rel-ml-1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import React, { Fragment } from "react";
import PropTypes from "prop-types";
import { i18next } from "@translations/invenio_app_rdm/i18next";
import { Popup, Icon } from "semantic-ui-react";

export const DisplayPartOfCommunities = ({ communities }) => {
const PartOfCommunities = () => {
Expand All @@ -24,6 +25,15 @@ export const DisplayPartOfCommunities = ({ communities }) => {
<a href={`/communities/${community.slug}`}>
{community.metadata?.title}
</a>
<span>&nbsp;</span>
{community.is_verified && (
<Popup
trigger={<Icon name="check outline circle" color="green mr-0" />}
content="Verified community"
position="top center"
/>
)}

{index !== communitiesEntries.length - 1 && ", "}
</Fragment>
);
Expand All @@ -32,6 +42,7 @@ export const DisplayPartOfCommunities = ({ communities }) => {
);
}
};

return (
<p>
<b>{PartOfCommunities()}</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,16 @@ import _isEmpty from "lodash/isEmpty";
import PropTypes from "prop-types";
import React, { Component } from "react";
import { Image } from "react-invenio-forms";
import { Item, Message, Popup, Placeholder, Header, Icon } from "semantic-ui-react";
import {
Grid,
Item,
Message,
Popup,
Placeholder,
Header,
HeaderSubheader,
Icon,
} from "semantic-ui-react";

export class RecordCommunitiesList extends Component {
render() {
Expand Down Expand Up @@ -48,25 +57,45 @@ export class RecordCommunitiesList extends Component {
const communityItems = communities
?.slice(0, maxDisplayedCommunities)
.map((community) => (
<Item key={community.id}>
<Image wrapped size="mini" src={community.links.logo} alt="" />
<Item.Content verticalAlign="middle">
<Item.Header as={Header}>
<Header as="a" href={community.links.self_html} size="small">
{community.metadata.title}
</Header>
{community.id === branded && community?.theme && (
<p className="ml-5 display-inline-block">
<Popup
content="Verified community"
trigger={<Icon color="green" name="check circle outline" />}
position="top center"
/>
</p>
)}
</Item.Header>
</Item.Content>
</Item>
<Grid key={community.id}>
<Grid.Row verticalAlign="middle">
<Grid.Column width={2}>
<Image wrapped size="mini" src={community.links.logo} alt="" />
</Grid.Column>
<Grid.Column width={14}>
<Item.Content>
<Item.Header className="ui">
<Header as="a" href={community.links.self_html} size="small">
{community.metadata.title}
{community.is_verified && (
<p className="ml-5 display-inline-block">
<Popup
content="Verified community"
trigger={
<Icon
size="small"
color="green"
name="check circle outline"
/>
}
position="top center"
/>
</p>
)}
</Header>
{community.parent && (
<HeaderSubheader>
Part of{" "}
<a href={`/communities/${community.parent.slug}`}>
{community.parent.metadata.title}
</a>
</HeaderSubheader>
)}
</Item.Header>
</Item.Content>
</Grid.Column>
</Grid.Row>
</Grid>
));

Element = (
Expand Down

0 comments on commit d6b3e39

Please sign in to comment.