-
-
- {' '}
-
{' '}
+export const projectCardPlaceholderTemplate =
+ (cardWidthClass = 'w-25-l') =>
+ (n, i) =>
+ (
+
+
+
+ {' '}
+ {' '}
+
+
+ {' '}
+ {' '}
+
+
+
+
+
+
-
- {' '}
- {' '}
-
-
-
-
-
-
-
-);
+ );
export const nCardPlaceholders = (N, cardWidthClass = 'w-25-l') => {
return [...Array(N).keys()].map(projectCardPlaceholderTemplate(cardWidthClass));
diff --git a/frontend/src/components/projectDetail/favorites.js b/frontend/src/components/projectDetail/favorites.js
index 62036f9537..c49234d09a 100644
--- a/frontend/src/components/projectDetail/favorites.js
+++ b/frontend/src/components/projectDetail/favorites.js
@@ -6,8 +6,8 @@ import { navigate } from '@reach/router';
import { useSelector } from 'react-redux';
import messages from './messages';
-export const AddToFavorites = props => {
- const userToken = useSelector(state => state.auth.get('token'));
+export const AddToFavorites = (props) => {
+ const userToken = useSelector((state) => state.auth.get('token'));
const [state, dispatchToggle] = useFavProjectAPI(false, props.projectId, userToken);
const isFav = state.isFav;
const isLoading = state.isLoading;
diff --git a/frontend/src/components/projectDetail/questionsAndComments.js b/frontend/src/components/projectDetail/questionsAndComments.js
index 3534d04dad..40bb5ed41f 100644
--- a/frontend/src/components/projectDetail/questionsAndComments.js
+++ b/frontend/src/components/projectDetail/questionsAndComments.js
@@ -35,7 +35,7 @@ export const PostProjectComment = ({ projectId, updateComments }) => {
return (
{
isShowPreview={isShowPreview}
isProjectDetailCommentSection={true}
/>
-
+
@@ -91,10 +91,9 @@ export const QuestionsAndComments = ({ projectId }) => {
useEffect(() => {
if (projectId && page) {
- fetchLocalJSONAPI(
- `projects/${projectId}/comments/?perPage=5&page=${page}`,
- token,
- ).then((res) => setComments(res));
+ fetchLocalJSONAPI(`projects/${projectId}/comments/?perPage=5&page=${page}`, token).then(
+ (res) => setComments(res),
+ );
}
}, [page, projectId, token]);
diff --git a/frontend/src/components/projectEdit/actionsForm.js b/frontend/src/components/projectEdit/actionsForm.js
index 95fc5b69f1..d5897262cb 100644
--- a/frontend/src/components/projectEdit/actionsForm.js
+++ b/frontend/src/components/projectEdit/actionsForm.js
@@ -363,52 +363,53 @@ const MessageContributorsModal = ({ projectId, close }: Object) => {
const TransferProject = ({ projectId, orgId }: Object) => {
const token = useSelector((state) => state.auth.get('token'));
- const { projectInfo, } = useContext(StateContext);
+ const { projectInfo } = useContext(StateContext);
const [username, setUsername] = useState('');
const [managers, setManagers] = useState([]);
const [admins, setAdmins] = useState([]);
const [isFetchingOptions, setIsFetchingOptions] = useState(true);
useEffect(() => {
- fetchLocalJSONAPI(`organisations/${orgId}/?omitManagerList=false`, token).then((r) =>
- setManagers(r.managers.map((m) => m.username))).then(() =>
- setIsFetchingOptions(false));
+ fetchLocalJSONAPI(`organisations/${orgId}/?omitManagerList=false`, token)
+ .then((r) => setManagers(r.managers.map((m) => m.username)))
+ .then(() => setIsFetchingOptions(false));
fetchLocalJSONAPI(`users/?pagination=false`, token).then((t) =>
- setAdmins(t.users.map((u) => u.username)))
+ setAdmins(t.users.map((u) => u.username)),
+ );
}, [token, orgId]);
const optionsExtended = [
{
label: projectInfo.organisationName,
- options: managers?.map(manager => ({
+ options: managers?.map((manager) => ({
label: manager,
value: manager,
- }))
+ })),
},
{
label:
,
- options: admins?.filter(
- admin => !managers?.includes(admin)
- ).map(adminName => ({
- label: adminName,
- value: adminName,
- }))
+ options: admins
+ ?.filter((admin) => !managers?.includes(admin))
+ .map((adminName) => ({
+ label: adminName,
+ value: adminName,
+ })),
},
];
const handleSelect = (value) => {
setUsername(value);
};
- const { username: loggedInUsername, role: loggedInUserRole } = useSelector((state) => state.auth.get('userDetails'));
- const hasAccess = (
+ const { username: loggedInUsername, role: loggedInUserRole } = useSelector((state) =>
+ state.auth.get('userDetails'),
+ );
+ const hasAccess =
managers?.includes(loggedInUsername) ||
loggedInUserRole === 'ADMIN' ||
- loggedInUsername === projectInfo.author
- );
+ loggedInUsername === projectInfo.author;
const isDisabled = () => {
- return (
- transferOwnershipAsync.status === 'pending' || !username || !hasAccess)
+ return transferOwnershipAsync.status === 'pending' || !username || !hasAccess;
};
const transferOwnership = () => {
return pushToLocalJSONAPI(
@@ -428,11 +429,10 @@ const TransferProject = ({ projectId, orgId }: Object) => {
getOptionLabel={({ label }) => label}
getOptionValue={({ value }) => value}
onChange={(e) => handleSelect(e?.value)}
- value={optionsExtended?.find(manager => manager.value === username)}
+ value={optionsExtended?.find((manager) => manager.value === username)}
options={optionsExtended}
isLoading={isFetchingOptions}
- >
-
+ >