= ({ item }) => {
}}
isVerified={isUserVerified(item._createdBy)}
/>
+ {Boolean(collaborators.length) && (
+
+ {collaborators.length +
+ (collaborators.length === 1
+ ? ' contributor'
+ : ' contributors')}
+
+ )}
{/* Hide this on mobile, show on tablet & above. */}
,
- title: 'Research',
- description: 'Welcome to research',
- // requiredRole: 'beta-tester',
-}
-
/**
* Wraps the research module routing elements with the research module provider
*/
-function ResearchModuleContainer() {
+const ResearchModuleContainer = () => {
const { aggregationsStore } = useCommonStores().stores
// Ensure aggregations up-to-date when using any child pages and unsubscribe when leaving
@@ -44,3 +30,17 @@ function ResearchModuleContainer() {
)
}
+
+/**
+ * Default export format used for integrating with the platform
+ * @description The research module enables users to share ongoing updates for
+ * experimental projects
+ */
+export const ResearchModule: IPageMeta = {
+ moduleName: MODULE.RESEARCH,
+ path: '/research',
+ component: ,
+ title: 'Research',
+ description: 'Welcome to research',
+ // requiredRole: 'beta-tester',
+}
diff --git a/src/pages/Research/research.routes.test.tsx b/src/pages/Research/research.routes.test.tsx
index 3e0f4cea43..106c7d19c6 100644
--- a/src/pages/Research/research.routes.test.tsx
+++ b/src/pages/Research/research.routes.test.tsx
@@ -13,21 +13,19 @@ import type { ResearchStore } from 'src/stores/Research/research.store'
jest.mock('src/index', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
- useCommonStores() {
- return {
- stores: {
- userStore: {
- fetchAllVerifiedUsers: jest.fn(),
- },
- aggregationsStore: {
- aggregations: {},
- },
- researchCategoriesStore: {
- allResearchCategories: [],
- },
+ useCommonStores: () => ({
+ stores: {
+ userStore: {
+ fetchAllVerifiedUsers: jest.fn(),
+ },
+ aggregationsStore: {
+ aggregations: {},
},
- }
- },
+ researchCategoriesStore: {
+ allResearchCategories: [],
+ },
+ },
+ }),
}))
/** When mocking research routes replace default store methods with below */
@@ -59,9 +57,7 @@ const mockResearchStore = new mockResearchStoreClass()
jest.mock('src/stores/Research/research.store', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
- useResearchStore() {
- return mockResearchStore
- },
+ useResearchStore: () => mockResearchStore,
}))
describe('research.routes', () => {
@@ -211,9 +207,7 @@ describe('research.routes', () => {
jest.doMock('src/pages/Research/Content/Common/Research.form', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
- default(props) {
- return {props.parentType} your research
- },
+ default: (props) => {props.parentType} your research
,
}))
const wrapper = render(
@@ -263,9 +257,7 @@ describe('research.routes', () => {
jest.doMock('src/pages/Research/Content/Common/Research.form', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
- default(props) {
- return {props.parentType} your research
- },
+ default: (props) => {props.parentType} your research
,
}))
const wrapper = render(
@@ -319,9 +311,7 @@ describe('research.routes', () => {
jest.doMock('src/pages/Research/Content/EditUpdate/index.tsx', () => ({
// eslint-disable-next-line @typescript-eslint/naming-convention
__esModule: true,
- default() {
- return Edit update within research
- },
+ default: () => Edit update within research
,
}))
const wrapper = render(
diff --git a/src/pages/Settings/SettingsPage.tsx b/src/pages/Settings/SettingsPage.tsx
index 66ea5c5495..7392fe8239 100644
--- a/src/pages/Settings/SettingsPage.tsx
+++ b/src/pages/Settings/SettingsPage.tsx
@@ -1,6 +1,6 @@
import * as React from 'react'
import { Card, Flex, Heading, Box, Text } from 'theme-ui'
-import type { IUserPP } from 'src/models/user_pp.models'
+import type { IUserPP } from 'src/models/userPreciousPlastic.models'
import type { ThemeStore } from 'src/stores/Theme/theme.store'
import type { UserStore } from 'src/stores/User/user.store'
import { observer, inject } from 'mobx-react'
@@ -26,6 +26,7 @@ import { logger } from 'src/logger'
import { ProfileType } from 'src/modules/profile/types'
import { AuthWrapper } from 'src/common/AuthWrapper'
import { UnsavedChangesDialog } from 'src/common/Form/UnsavedChangesDialog'
+import { v4 as uuid } from 'uuid'
interface IProps {
/** user ID for lookup when editing another user as admin */
@@ -86,7 +87,10 @@ export class SettingsPage extends React.Component {
coverImages: new Array(4)
.fill(null)
.map((v, i) => (coverImages[i] ? coverImages[i] : v)),
- links: links.length > 0 ? links : [{} as any],
+ links: (links.length > 0 ? links : [{} as any]).map((i) => ({
+ ...i,
+ key: uuid(),
+ })),
openingHours: openingHours!.length > 0 ? openingHours : [{} as any],
}
this.setState({
diff --git a/src/pages/Settings/Template.tsx b/src/pages/Settings/Template.tsx
index 1548e84f6a..72f001ffcd 100644
--- a/src/pages/Settings/Template.tsx
+++ b/src/pages/Settings/Template.tsx
@@ -1,4 +1,4 @@
-import type { IUserPP } from 'src/models/user_pp.models'
+import type { IUserPP } from 'src/models/userPreciousPlastic.models'
import type { IUser } from 'src/models/user.models'
import { ProfileType } from 'src/modules/profile/types'
diff --git a/src/pages/Settings/UserBadgeSettings.tsx b/src/pages/Settings/UserBadgeSettings.tsx
index 05128c6ca2..615dfcade0 100644
--- a/src/pages/Settings/UserBadgeSettings.tsx
+++ b/src/pages/Settings/UserBadgeSettings.tsx
@@ -17,7 +17,7 @@ export const UserBadgeSettings = observer((props: { userId: string }) => {
const [isLoading, setLoading] = useState(true)
const [isSaving, setSaving] = useState(false)
- async function fetchUser() {
+ const fetchUser = async () => {
const user = await userStore.getUserProfile(props.userId)
if (user && user.badges) {
setBadges(user.badges)
diff --git a/src/pages/Settings/content/formSections/Collection.section.tsx b/src/pages/Settings/content/formSections/Collection.section.tsx
index ecf193132f..96b955f29f 100644
--- a/src/pages/Settings/content/formSections/Collection.section.tsx
+++ b/src/pages/Settings/content/formSections/Collection.section.tsx
@@ -1,5 +1,5 @@
import * as React from 'react'
-import type { IUserPP } from 'src/models/user_pp.models'
+import type { IUserPP } from 'src/models/userPreciousPlastic.models'
import type { IPlasticType } from 'src/models'
import { Flex, Heading, Box, Text, Grid } from 'theme-ui'
diff --git a/src/pages/Settings/content/formSections/Fields/Link.field.tsx b/src/pages/Settings/content/formSections/Fields/ProfileLink.field.tsx
similarity index 66%
rename from src/pages/Settings/content/formSections/Fields/Link.field.tsx
rename to src/pages/Settings/content/formSections/Fields/ProfileLink.field.tsx
index 3393219fab..6327216abc 100644
--- a/src/pages/Settings/content/formSections/Fields/Link.field.tsx
+++ b/src/pages/Settings/content/formSections/Fields/ProfileLink.field.tsx
@@ -1,7 +1,7 @@
import { Component } from 'react'
import { Field } from 'react-final-form'
import { Button, FieldInput, Modal } from 'oa-components'
-import { Text, Flex, Grid } from 'theme-ui'
+import { Text, Flex, Grid, Box } from 'theme-ui'
import { SelectField } from 'src/common/Form/Select.field'
import { validateUrl, validateEmail, required } from 'src/utils/validators'
import { formatLink } from 'src/utils/formatters'
@@ -31,7 +31,9 @@ interface IProps {
initialType?: string
onDelete: () => void
'data-cy'?: string
+ isDeleteEnabled: boolean
}
+
interface IState {
showDeleteModal: boolean
_toDocsList: boolean
@@ -74,7 +76,7 @@ export class ProfileLinkField extends Component {
}
render() {
- const { index, name } = this.props
+ const { index, name, isDeleteEnabled } = this.props
const DeleteButton = (props) => (
)
return (
-
-
-
+
+
+
{
placeholder="type"
validate={required}
validateFields={[]}
- style={{ width: '100%', height: '40px', marginRight: '8px' }}
+ style={{ width: '100%', height: '40px' }}
/>
-
-
+