forked from inveniosoftware/invenio-communities
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
membership-request [inveniosoftware#855]: implement wait for decision…
… flow
- Loading branch information
Showing
39 changed files
with
1,264 additions
and
96 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...tic-ui/js/invenio_communities/api/membershipRequests/MembershipRequestsContextProvider.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// This file is part of Invenio-communities | ||
// Copyright (C) 2022 CERN. | ||
// Copyright (C) 2024 Northwestern University. | ||
// | ||
// Invenio-communities is free software; you can redistribute it and/or modify it | ||
// under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
import { CommunityMembershipRequestsApi } from "./api"; | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
|
||
export const MembershipRequestsContext = React.createContext({ api: undefined }); | ||
|
||
export class MembershipRequestsContextProvider extends Component { | ||
constructor(props) { | ||
super(props); | ||
const { community } = props; | ||
this.apiClient = new CommunityMembershipRequestsApi(community); | ||
} | ||
render() { | ||
const { children } = this.props; | ||
return ( | ||
<MembershipRequestsContext.Provider value={{ api: this.apiClient }}> | ||
{children} | ||
</MembershipRequestsContext.Provider> | ||
); | ||
} | ||
} | ||
|
||
MembershipRequestsContextProvider.propTypes = { | ||
community: PropTypes.object.isRequired, | ||
children: PropTypes.node.isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...io_communities/assets/semantic-ui/js/invenio_communities/members/MemberRequestsResults.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* This file is part of Invenio. | ||
* Copyright (C) 2022 CERN. | ||
* Copyright (C) 2024 Northwestern University. | ||
* | ||
* Invenio is free software; you can redistribute it and/or modify it | ||
* under the terms of the MIT License; see LICENSE file for more details. | ||
*/ | ||
|
||
import React from "react"; | ||
import { Grid } from "semantic-ui-react"; | ||
import { ResultsPerPage, Pagination, ResultsList } from "react-searchkit"; | ||
import PropTypes from "prop-types"; | ||
import { Trans } from "react-i18next"; | ||
|
||
export const MemberRequestsResults = ({ paginationOptions, currentResultsState }) => { | ||
const { total } = currentResultsState.data; | ||
return ( | ||
total && ( | ||
<Grid> | ||
<Grid.Row> | ||
<Grid.Column width={16}> | ||
<ResultsList /> | ||
</Grid.Column> | ||
</Grid.Row> | ||
<Grid.Row verticalAlign="middle"> | ||
<Grid.Column width={8} textAlign="right"> | ||
<Pagination | ||
options={{ | ||
size: "mini", | ||
showFirst: false, | ||
showLast: false, | ||
}} | ||
/> | ||
</Grid.Column> | ||
<Grid.Column textAlign="right" width={8}> | ||
<ResultsPerPage | ||
values={paginationOptions.resultsPerPage} | ||
label={(cmp) => ( | ||
// kept key for translation purposes - it should be | ||
// the same across members, invitations, membership requests | ||
// and beyond | ||
<Trans key="communitiesInvitationsResult" count={cmp}> | ||
{cmp} results per page | ||
</Trans> | ||
)} | ||
/> | ||
</Grid.Column> | ||
</Grid.Row> | ||
</Grid> | ||
) | ||
); | ||
}; | ||
|
||
MemberRequestsResults.propTypes = { | ||
paginationOptions: PropTypes.object.isRequired, | ||
currentResultsState: PropTypes.object.isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...c-ui/js/invenio_communities/members/membership_requests/MembershipRequestsEmptyResults.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { Component } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Button, Header, Icon, Segment } from "semantic-ui-react"; | ||
import { withState } from "react-searchkit"; | ||
import { i18next } from "@translations/invenio_communities/i18next"; | ||
|
||
class MembershipRequestsEmptyResultsCmp extends Component { | ||
render() { | ||
const { resetQuery, extraContent, queryString } = this.props; | ||
|
||
return ( | ||
<Segment.Group> | ||
<Segment placeholder textAlign="center"> | ||
<Header icon> | ||
<Icon name="search" /> | ||
{i18next.t("No matching members found.")} | ||
</Header> | ||
{queryString && ( | ||
<p> | ||
<em> | ||
{i18next.t("Current search")} "{queryString}" | ||
</em> | ||
</p> | ||
)} | ||
<Button primary onClick={() => resetQuery()}> | ||
{i18next.t("Clear query")} | ||
</Button> | ||
{extraContent} | ||
</Segment> | ||
</Segment.Group> | ||
); | ||
} | ||
} | ||
|
||
MembershipRequestsEmptyResultsCmp.propTypes = { | ||
resetQuery: PropTypes.func.isRequired, | ||
queryString: PropTypes.string.isRequired, | ||
extraContent: PropTypes.node, | ||
}; | ||
|
||
MembershipRequestsEmptyResultsCmp.defaultProps = { | ||
extraContent: null, | ||
}; | ||
|
||
export const MembershipRequestsEmptyResults = withState( | ||
MembershipRequestsEmptyResultsCmp | ||
); |
Oops, something went wrong.