diff --git a/src/analytics/location.analytic.ts b/src/analytics/location.analytic.ts index 52de3fb08..eb6d9829e 100644 --- a/src/analytics/location.analytic.ts +++ b/src/analytics/location.analytic.ts @@ -1,15 +1,11 @@ import analytics from '@/analytics/index' -import { LocationType } from '@/models/types' +import { ProjectLocationForm } from '@/models/location.model' export interface LocationAnalytic { project: { id: string } - location: { - lat: number - lng: number - type: LocationType - } + location: ProjectLocationForm } export default { diff --git a/src/api/crisalid.service.ts b/src/api/crisalid.service.ts new file mode 100644 index 000000000..b14a013e1 --- /dev/null +++ b/src/api/crisalid.service.ts @@ -0,0 +1,66 @@ +import { + Document, + DocumentType, + Researcher, + ResearcherDocumentAnalytics, +} from '@/interfaces/researcher' +import { PeopleGroupModel } from '@/models/invitation.model' + +export async function getOwnResearchDocument( + organisationCode: string, + researchId: Researcher['id'], + documentType: DocumentType, + config = {} +) { + return await useAPI>( + `crisalid/organization/${organisationCode}/researcher/${researchId}/${documentType}/`, + config + ) +} + +export async function getGroupResearchDocument( + organisationCode: string, + groupId: PeopleGroupModel['id'], + documentType: DocumentType, + config = {} +) { + return await useAPI>( + `crisalid/organization/${organisationCode}/people-group/${groupId}/${documentType}/`, + config + ) +} + +export async function getOwnResearchDocumentAnalytics( + organisationCode: string, + researchId: Researcher['id'], + documentType: DocumentType, + config = {} +) { + return await useAPI( + `crisalid/organization/${organisationCode}/researcher/${researchId}/${documentType}/analytics/`, + config + ) +} + +export async function getGroupResearchDocumentAnalytics( + organisationCode: string, + groupId: PeopleGroupModel['id'], + documentType: DocumentType, + config = {} +) { + return await useAPI( + `crisalid/organization/${organisationCode}/people-group/${groupId}/${documentType}/analytics/`, + config + ) +} + +export async function getResearchDocumentSimilars( + organisationCode: string, + documentId: Document['id'], + config = {} +) { + return await useAPI>( + `crisalid/organization/${organisationCode}/document/${documentId}/similars/`, + config + ) +} diff --git a/src/api/follows.service.ts b/src/api/follows.service.ts index 52b9643b9..ab91ae67e 100644 --- a/src/api/follows.service.ts +++ b/src/api/follows.service.ts @@ -1,6 +1,7 @@ import type { AddManyFollowedProject, FollowInput, + FollowProjectOutput, // FollowOutput, // FollowOutputList, } from '@/models/follow.model' @@ -16,7 +17,10 @@ export async function getUserFollows(body: FollowInput, params) { } export async function postFollow(follow: FollowInput) { - return await useAPI(`project/${follow.project_id}/follow/`, { body: follow, method: 'POST' }) + return await useAPI(`project/${follow.project_id}/follow/`, { + body: follow, + method: 'POST', + }) //.data.value } diff --git a/src/api/groups.service.ts b/src/api/groups.service.ts index 2f75e1604..f502b910d 100644 --- a/src/api/groups.service.ts +++ b/src/api/groups.service.ts @@ -1,31 +1,35 @@ import type { - // GroupModel, - // GroupOuput, PostGroupData, AddGroupMembers, RemoveGroupMember, PostGroupProjects, AddParentGroupModelInput, + GroupMember, + HierarchyGroupModel, } from '@/models/group.model' -// import type { HierarchyGroupModel } from '@/models/group.model' -// import type { APIResponseList } from '@/api/types' import { _adaptParamsToGetQuery } from '@/api/utils.service' import useAPI from '@/composables/useAPI' +import { ProjectModel } from '@/models/project.model' +import { PeopleGroupModel } from '@/models/invitation.model' +import { LocationModel } from '@/models/location.model' +import { ImageModel } from '@/models/image.model' // HIERARCHY - -export async function getHierarchyGroups(org: string) { - return await useAPI(`organization/${org}/people-groups-hierarchy/`, {}) //.data.value +export async function getHierarchyGroups(organizationCode: string, config = {}) { + return await useAPI>( + `organization/${organizationCode}/people-groups-hierarchy/`, + config + ) } export async function getPeopleGroupsHierarchy(org_code, params) { return await useAPI(`organization/${org_code}/people-groups-hierarchy/`, { ..._adaptParamsToGetQuery(params), - }) //.data.value + }) } export async function getGroups(org_id) { - return await useAPI(`organization/${org_id}/people-group/`, {}) //.data.value + return await useAPI(`organization/${org_id}/people-group/`, {}) } // ALL GROUPS @@ -33,80 +37,85 @@ export async function getGroups(org_id) { export async function getPeopleGroups(org_code, params) { return await useAPI(`organization/${org_code}/people-group/`, { ..._adaptParamsToGetQuery(params), - }) //.data.value + }) } export async function postGroup(org: string, groupData: PostGroupData) { return await useAPI(`organization/${org}/people-group/`, { body: groupData, method: 'POST' }) - //.data.value } // GROUP export async function addParentGroup( orgId: string, - groupId: string, + groupId: number, body: AddParentGroupModelInput ) { - return await useAPI(`organization/${orgId}/people-group/${groupId}/`, { body, method: 'PATCH' }) //.data.value + return await useAPI(`organization/${orgId}/people-group/${groupId}/`, { body, method: 'PATCH' }) } -export async function getGroup(org: string, groupId: string, noError: boolean = false) { - return await useAPI( - `/organization/${org}/people-group/${groupId}/`, - { noError: noError } // TODO nuxt check error silenced - ) //.data.value +export function getGroup(organizationCode: string, groupId: number, config = {}) { + return useAPI( + `organization/${organizationCode}/people-group/${groupId}/`, + config + ) } -export async function patchGroup(org: string, group_id: number, groupData: Partial) { - return await useAPI(`organization/${org}/people-group/${group_id}/`, { +export async function patchGroup( + organizationCode: string, + groupName: number, + groupData: Partial +) { + return await useAPI(`organization/${organizationCode}/people-group/${groupName}/`, { body: groupData, method: 'PATCH', - }) //.data.value + }) } -export async function deleteGroup(org_code, group_id) { - return await useAPI(`organization/${org_code}/people-group/${group_id}/`, { method: 'DELETE' }) //.data.value +export async function deleteGroup(organizationCode: string, groupName: string) { + return await useAPI(`organization/${organizationCode}/people-group/${groupName}/`, { + method: 'DELETE', + }) } // GROUP MEMBERS -export async function getGroupMember(org: string, groupId: string, noError: boolean = false) { - return ( - // TODO nuxt check error silenced - await useAPI(`organization/${org}/people-group/${groupId}/member/`, { noError: noError }) - //.data.value +export async function getGroupMember(organizationCode: string, groupId: number, config = {}) { + return await useAPI>( + `organization/${organizationCode}/people-group/${groupId}/member/`, + config ) } export async function postGroupMembers( - org: string, - group_id: number, + organizationCode: string, + groupId: number, membersData: AddGroupMembers ) { - return await useAPI(`organization/${org}/people-group/${group_id}/member/add/`, { + return await useAPI(`organization/${organizationCode}/people-group/${groupId}/member/add/`, { body: membersData, method: 'POST', - }) //.data.value + }) } export async function removeGroupMember( - org: string, - group_id: number, + organizationCode: string, + groupId: number, membersData: RemoveGroupMember ) { - return await useAPI(`organization/${org}/people-group/${group_id}/member/remove/`, { + return await useAPI(`organization/${organizationCode}/people-group/${groupId}/member/remove/`, { body: membersData, method: 'POST', - }) //.data.value + }) } // GROUP PROJECTS -export async function getGroupProject(org: string, groupId: string, noError: boolean = false) { - return await useAPI(`organization/${org}/people-group/${groupId}/project/`, { - noError: noError, - }) //.data.value +export async function getGroupProject(organizationCode: string, groupId: number, config = {}) { + return await useAPI>( + `organization/${organizationCode}/people-group/${groupId}/project/`, + config + ) } export async function postGroupProjects( @@ -117,14 +126,18 @@ export async function postGroupProjects( return await useAPI(`organization/${org}/people-group/${group_id}/project/add/`, { body: projectsData, method: 'POST', - }) //.data.value + }) } -export async function removeGroupProject(org: string, group_id: number, projectsData: any) { +export async function removeGroupProject( + org: string, + group_id: number, + projectsData: PostGroupProjects +) { return await useAPI(`organization/${org}/people-group/${group_id}/project/remove/`, { body: projectsData, method: 'POST', - }) //.data.value + }) } // GROUP HEADER @@ -133,12 +146,70 @@ export async function postGroupHeader(org: string, group_id: number, headerData: return await useAPI(`organization/${org}/people-group/${group_id}/header/`, { body: headerData, method: 'POST', - }) //.data.value + }) } export async function patchGroupHeader(org: string, group_id: number, headerData: FormData) { return await useAPI(`organization/${org}/people-group/${group_id}/header/`, { body: headerData, method: 'PATCH', - }) //.data.value + }) +} + +export async function getGroupSimilar(organizationCode: string, groupId: number, config = {}) { + return await useAPI>( + `organization/${organizationCode}/people-group/${groupId}/similars/`, + config + ) +} + +export async function getSubGroup(organizationCode: string, groupId: number, config = {}) { + return await useAPI>( + `organization/${organizationCode}/people-group/${groupId}/subgroups/`, + config + ) +} + +export async function getGroupLocation(organizationCode: string, groupId: number, config = {}) { + return await useAPI>( + `organization/${organizationCode}/people-group/${groupId}/locations/`, + config + ) +} + +export function getGroupGallery(organizationCode: string, groupId: number, config = {}) { + return useAPI>( + `organization/${organizationCode}/people-group/${groupId}/gallery/`, + { + ...config, + } + ) +} + +export function deleteGroupGallery( + organizationCode: string, + groupId: number, + imageId: number, + config = {} +) { + return useAPI( + `organization/${organizationCode}/people-group/${groupId}/gallery/${imageId}/`, + { + ...config, + method: 'DELETE', + } + ) +} + +export function postGroupGallery( + organizationCode: string, + groupId: number, + body: FormData, + config = {} +) { + return useAPI(`organization/${organizationCode}/people-group/${groupId}/gallery/`, { + ...config, + body, + method: 'POST', + }) } diff --git a/src/api/locations.services.ts b/src/api/locations.services.ts index a4300637a..88a69acec 100644 --- a/src/api/locations.services.ts +++ b/src/api/locations.services.ts @@ -1,6 +1,5 @@ import type { LocationModel, ProjectLocationForm } from '@/models/location.model' import useAPI from '@/composables/useAPI' -import utils from '@/functs/functions' import { Locations } from '@/interfaces/maps' export async function getProjectLocations(projectId: number) { @@ -11,13 +10,8 @@ export async function getProjectLocation(projectId: string, locationId: number) return await useAPI(`project/${projectId}/location/${locationId}/`) } -export async function getLocations(params, next) { - if (next) { - // TODO: nuxt check next works - return await useAPI(next, {}) //.data.value - } - - return await useAPI(`location/`, { ...utils.adaptParam(params) }) //.data.value +export async function getLocations(organizationCode: string, config = {}) { + return await useAPI(`organization/${organizationCode}/location/`, config) } export async function postLocations(projectId: string, body: ProjectLocationForm) { diff --git a/src/api/sanitizes/researcher.ts b/src/api/sanitizes/researcher.ts index 24ca84bfe..c7a7435a0 100644 --- a/src/api/sanitizes/researcher.ts +++ b/src/api/sanitizes/researcher.ts @@ -44,7 +44,8 @@ type AnalyticsYears = { * @exports */ export const sanitizeResearcherDocumentAnalyticsYears = ( - data: ResearcherDocumentAnalytics['years'] + data: ResearcherDocumentAnalytics['years'], + limit?: number ): AnalyticsYears => { const info: AnalyticsYears = { minYear: null, @@ -52,12 +53,6 @@ export const sanitizeResearcherDocumentAnalyticsYears = ( bar: [], } data.forEach((o) => { - if (info.minYear == null || info.minYear > o.year) { - info.minYear = o.year - } - if (info.maxYear == null || info.maxYear < o.year) { - info.maxYear = o.year - } info.bar.push({ count: o.total, year: o.year, @@ -65,13 +60,18 @@ export const sanitizeResearcherDocumentAnalyticsYears = ( }) }) + info.bar = info.bar.toSorted((a, b) => a.year - b.year) + if (limit) { + info.bar = info.bar.slice(-limit) + } + info.minYear = info.bar.at(0).year + info.maxYear = info.bar.at(-1).year + const maxCount = Math.max(...info.bar.map((el) => el.count)) info.bar.forEach((obj) => { obj.height = (obj.count / maxCount) * 100 }) - info.bar = info.bar.reverse() - return info } diff --git a/src/api/v2/crisalid.service.ts b/src/api/v2/crisalid.service.ts new file mode 100644 index 000000000..22e652244 --- /dev/null +++ b/src/api/v2/crisalid.service.ts @@ -0,0 +1,152 @@ +import { + getOwnResearchDocument as fetchOwnResearchDocument, + getGroupResearchDocument as fetchGroupResearchDocument, + getResearchDocumentSimilars as fetchResearchDocumentSimilars, + getOwnResearchDocumentAnalytics as fetchOwnResearchDocumentAnalytics, + getGroupResearchDocumentAnalytics as fetchGroupResearchDocumentAnalytics, +} from '@/api/crisalid.service' +import useAsyncAPI from '@/composables/useAsyncAPI' +import useAsyncPaginationAPI from '@/composables/useAsyncPaginationAPI' +import { onlyRefs } from '@/functs/onlyRefs' +import { Document, DocumentType, Researcher } from '@/interfaces/researcher' +import { RefOrRaw } from '@/interfaces/utils' +import { GroupModel } from '@/models/group.model' +import { PeopleGroupModel } from '@/models/invitation.model' +import { OrganizationModel } from '@/models/organization.model' + +const DEFAULT_CONFIG = {} + +export const getOwnResearchDocument = ( + organizationCode: RefOrRaw, + researcherId: RefOrRaw, + documenType: DocumentType, + config = {} +) => { + const { translateResearcherDocuments } = useAutoTranslate() + const key = computed( + () => `${unref(organizationCode)}::researcher::${unref(researcherId)}::${documenType}` + ) + + return useAsyncPaginationAPI( + key, + ({ config }) => + fetchOwnResearchDocument(unref(organizationCode), unref(researcherId), unref(documenType), { + ...DEFAULT_CONFIG, + ...config, + }), + { + translate: (data) => translateResearcherDocuments(data), + watch: onlyRefs([organizationCode, researcherId]), + ...config, + } + ) +} + +export const getGroupResearchDocument = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + documenType: DocumentType, + config = {} +) => { + const { translateResearcherDocuments } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}::${documenType}`) + + return useAsyncPaginationAPI( + key, + ({ config }) => + fetchGroupResearchDocument(unref(organizationCode), unref(groupId), unref(documenType), { + ...DEFAULT_CONFIG, + ...config, + }), + { + translate: (data) => translateResearcherDocuments(data), + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getOwnResearchDocumentAnalytics = ( + organizationCode: RefOrRaw, + researcherId: RefOrRaw, + documenType: DocumentType, + config = {} +) => { + const key = computed( + () => + `${unref(organizationCode)}::researcher::${unref(researcherId)}::${documenType}::analytics` + ) + + return useAsyncAPI( + key, + ({ config }) => + fetchOwnResearchDocumentAnalytics( + unref(organizationCode), + unref(researcherId), + unref(documenType), + { + ...DEFAULT_CONFIG, + ...config, + } + ), + { + watch: onlyRefs([organizationCode, researcherId]), + ...config, + } + ) +} + +export const getGroupResearchDocumentAnalytics = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + documenType: DocumentType, + config = {} +) => { + const key = computed( + () => `${unref(organizationCode)}::group::${unref(groupId)}::${documenType}::analytics` + ) + + return useAsyncAPI( + key, + ({ config }) => + fetchGroupResearchDocumentAnalytics( + unref(organizationCode), + unref(groupId), + unref(documenType), + { + ...DEFAULT_CONFIG, + ...config, + } + ), + { + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getResearchDocumentSimilars = ( + organizationCode: RefOrRaw, + documentId: RefOrRaw, + config = {} +) => { + const { translateResearcherDocuments } = useAutoTranslate() + const key = computed( + () => `${unref(organizationCode)}::crisalid::document::${unref(documentId)}::similars` + ) + + return useAsyncPaginationAPI( + key, + ({ config }) => + fetchResearchDocumentSimilars(unref(organizationCode), unref(documentId), { + ...DEFAULT_CONFIG, + ...config, + }), + { + translate: (data) => translateResearcherDocuments(data), + watch: onlyRefs([organizationCode, documentId]), + checkArgs: true, + ...config, + } + ) +} diff --git a/src/api/v2/group.service.ts b/src/api/v2/group.service.ts new file mode 100644 index 000000000..c1ad4619e --- /dev/null +++ b/src/api/v2/group.service.ts @@ -0,0 +1,191 @@ +import { + getGroup as fetchGetGroup, + getGroupProject as fetchGetGroupProject, + getHierarchyGroups as fetchGetHierarchyGroups, + getGroupMember as fetchGetGroupMember, + getGroupSimilar as fetchGetGroupSimilar, + getSubGroup as fetchGetSubGroup, + getGroupLocation as fetchLocationsGroup, + getGroupGallery as fetchGroupGallery, +} from '@/api/groups.service' +import useAsyncAPI from '@/composables/useAsyncAPI' +import useAsyncPaginationAPI from '@/composables/useAsyncPaginationAPI' +import { onlyRefs } from '@/functs/onlyRefs' +import { RefOrRaw } from '@/interfaces/utils' +import { GroupModel } from '@/models/group.model' +import { OrganizationModel } from '@/models/organization.model' + +const DEFAULT_CONFIG = {} + +export const getGroup = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + config = {} +) => { + const { translateGroup } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}`) + + return useAsyncAPI( + key, + () => fetchGetGroup(unref(organizationCode), unref(groupId), { ...DEFAULT_CONFIG }), + { + translate: translateGroup, + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getHierarchyGroups = ( + organizationCode: RefOrRaw, + config = {} +) => { + const { translateGroup } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::hierarchy-groups`) + + return useAsyncAPI( + key, + ({ config }) => + fetchGetHierarchyGroups(unref(organizationCode), { ...DEFAULT_CONFIG, ...config }), + { + translate: translateGroup, + watch: onlyRefs([organizationCode]), + ...config, + } + ) +} + +export const getGroupProject = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + config = {} +) => { + const { translateProjects } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}::projects`) + + return useAsyncPaginationAPI( + key, + ({ config }) => + fetchGetGroupProject(unref(organizationCode), unref(groupId), { + ...DEFAULT_CONFIG, + ...config, + }), + { + translate: translateProjects, + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getGroupMember = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + config = {} +) => { + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}::members`) + + return useAsyncPaginationAPI( + key, + ({ config }) => + fetchGetGroupMember(unref(organizationCode), unref(groupId), { + ...DEFAULT_CONFIG, + ...config, + }), + { + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getGroupSimilar = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + config = {} +) => { + const { translateGroups } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}::similars`) + + return useAsyncPaginationAPI( + key, + ({ config }) => + fetchGetGroupSimilar(unref(organizationCode), unref(groupId), { + ...DEFAULT_CONFIG, + ...config, + }), + { + translate: translateGroups, + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getSubGroup = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + config = {} +) => { + const { translateGroups } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}::subgroup`) + + return useAsyncPaginationAPI( + key, + ({ config }) => + fetchGetSubGroup(unref(organizationCode), unref(groupId), { + ...DEFAULT_CONFIG, + ...config, + }), + { + translate: translateGroups, + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getGroupLocation = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + config = {} +) => { + const { translateProjectLocations } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}::locations`) + + return useAsyncAPI( + key, + ({ config }) => + fetchLocationsGroup(unref(organizationCode), unref(groupId), { + ...DEFAULT_CONFIG, + ...config, + }), + { + translate: translateProjectLocations, + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} + +export const getGroupGallery = ( + organizationCode: RefOrRaw, + groupId: RefOrRaw, + config = {} +) => { + const key = computed(() => `${unref(organizationCode)}::group::${unref(groupId)}::gallery`) + + return useAsyncPaginationAPI( + key, + async ({ config }) => { + return fetchGroupGallery(unref(organizationCode), unref(groupId), { + ...DEFAULT_CONFIG, + ...config, + }) + }, + { + watch: onlyRefs([organizationCode, groupId]), + ...config, + } + ) +} diff --git a/src/api/v2/location.service.ts b/src/api/v2/location.service.ts new file mode 100644 index 000000000..606b7ec6f --- /dev/null +++ b/src/api/v2/location.service.ts @@ -0,0 +1,31 @@ +import { getLocations as fetchGetLocations } from '@/api/locations.services' +import useAsyncAPI from '@/composables/useAsyncAPI' +import { onlyRefs } from '@/functs/onlyRefs' +import { Locations } from '@/interfaces/maps' +import { RefOrRaw } from '@/interfaces/utils' +import { OrganizationModel } from '@/models/organization.model' + +const DEFAULT_CONFIG = {} + +export const getLocations = ( + organizationCode: RefOrRaw, + config = {} +) => { + const { translatePeopleGroupLocations, translateProjectLocations } = useAutoTranslate() + const key = computed(() => `${unref(organizationCode)}::locations`) + + const translateAllModel = (data: ComputedRef) => { + return computed(() => { + return { + groups: unref(translatePeopleGroupLocations(data.value?.groups)), + projects: unref(translateProjectLocations(data.value?.projects)), + } + }) + } + + return useAsyncAPI(key, () => fetchGetLocations(unref(organizationCode), { ...DEFAULT_CONFIG }), { + translate: translateAllModel, + watch: onlyRefs([organizationCode]), + ...config, + }) +} diff --git a/src/app/fixLeaflet.ts b/src/app/fixLeaflet.ts index 48778ee25..6637b8113 100644 --- a/src/app/fixLeaflet.ts +++ b/src/app/fixLeaflet.ts @@ -2,7 +2,7 @@ import { Icon } from 'leaflet' export default function fixLeaflet() { // Resolves an issue where the markers would not appear - // @ts-expect-error error typing + // @ts-expect-error ignore prototype error delete Icon.Default.prototype._getIconUrl Icon.Default.mergeOptions({ iconRetinaUrl: 'leaflet/dist/images/marker-icon-2x.png', diff --git a/src/app/router.options.ts b/src/app/router.options.ts index df939e34a..02a9b8b2f 100644 --- a/src/app/router.options.ts +++ b/src/app/router.options.ts @@ -223,7 +223,7 @@ const routes = ({ { path: '/create-group', name: 'createGroup', - component: () => import('../pages/CreateEditGroupPage/CreateEditGroupPage.vue'), + component: () => import('../pages/GroupPageV2/Tabs/GroupEditTab.vue'), meta: { resetScroll: true, diff --git a/src/app/useAdminPagesRoutes.ts b/src/app/useAdminPagesRoutes.ts index f40ae039f..d5a963d19 100644 --- a/src/app/useAdminPagesRoutes.ts +++ b/src/app/useAdminPagesRoutes.ts @@ -103,7 +103,7 @@ export default function useAdminPagesRoutes() { { path: 'create', name: 'adminCreateGroup', - component: () => import('../pages/CreateEditGroupPage/CreateEditGroupPage.vue'), + component: () => import('../pages/GroupPageV2/Tabs/GroupEditTab.vue'), props: { postCancelRouteFactory: () => ({ name: 'groupsList' }), postCreateRouteFactory: () => ({ name: 'groupsList' }), @@ -120,7 +120,7 @@ export default function useAdminPagesRoutes() { postCreateRouteFactory: () => ({ name: 'groupsList' }), postUpdateRouteFactory: () => ({ name: 'groupsList' }), }), - component: () => import('../pages/CreateEditGroupPage/CreateEditGroupPage.vue'), + component: () => import('../pages/GroupPageV2/Tabs/GroupEditTab.vue'), }, ], }, diff --git a/src/app/useGroupPagesRoutes.ts b/src/app/useGroupPagesRoutes.ts index a88bc5b46..efaa2934a 100644 --- a/src/app/useGroupPagesRoutes.ts +++ b/src/app/useGroupPagesRoutes.ts @@ -15,12 +15,38 @@ export default function useGroupPagesRoutes() { { path: 'members', name: 'groupMembers', - component: () => import('../pages/GroupPageV2/Tabs/GroupMembersTab.vue'), + component: () => import('../pages/GroupPageV2/Tabs/Members/GroupMembersTab.vue'), }, { path: 'projects', name: 'groupProjects', - component: () => import('../pages/GroupPageV2/Tabs/GroupProjectsTab.vue'), + component: () => import('../pages/GroupPageV2/Tabs/Projects/GroupProjectsTab.vue'), + }, + { + path: 'publications', + name: 'groupPublications', + component: () => import('../pages/GroupPageV2/Tabs/Documents/GroupDocumentsTab.vue'), + props: () => ({ + documentType: 'publications', + }), + }, + { + path: 'conferences', + name: 'groupConferences', + component: () => import('../pages/GroupPageV2/Tabs/Documents/GroupDocumentsTab.vue'), + props: () => ({ + documentType: 'conferences', + }), + }, + { + path: 'locations', + name: 'groupLocations', + component: () => import('../pages/GroupPageV2/Tabs/Locations/GroupLocationsTab.vue'), + }, + { + path: 'gallery', + name: 'groupGallery', + component: () => import('../pages/GroupPageV2/Tabs/Gallery/GroupGalleryTab.vue'), }, // retro compat { @@ -36,17 +62,22 @@ export default function useGroupPagesRoutes() { isReducedMode: true, groupId: route.params.groupId, }), - component: () => import('../pages/CreateEditGroupPage/CreateEditGroupPage.vue'), + component: () => import('../pages/GroupPageV2/Tabs/GroupEditTab.vue'), }, { path: 'members/edit', name: 'groupMembersEdit', - component: () => import('../pages/GroupPageV2/Tabs/GroupMembersEditTab.vue'), + component: () => import('../pages/GroupPageV2/Tabs/Members/GroupMembersEditTab.vue'), }, { path: 'projects/edit', name: 'groupProjectsEdit', - component: () => import('../pages/GroupPageV2/Tabs/GroupProjectsEditTab.vue'), + component: () => import('../pages/GroupPageV2/Tabs/Projects/GroupProjectsEditTab.vue'), + }, + { + path: 'gallery/edit', + name: 'groupGalleryEdit', + component: () => import('../pages/GroupPageV2/Tabs/Gallery/GroupGalleryTab.vue'), }, ], props: true, diff --git a/src/components/base/form/TextInput.vue b/src/components/base/form/TextInput.vue index 9a1dd23be..d8e67722c 100644 --- a/src/components/base/form/TextInput.vue +++ b/src/components/base/form/TextInput.vue @@ -29,6 +29,7 @@ :disabled="disabled" :data-test="dataTest" :maxlength="maxLength" + @change="$emit('change', $event)" @keydown.enter="$emit('enter')" @focus="$emit('focus', $event)" @blur="$emit('blur', $event)" @@ -122,7 +123,7 @@ export default { }, }, - emits: ['update:modelValue', 'enter', 'focus', 'blur'], + emits: ['update:modelValue', 'enter', 'focus', 'blur', 'change'], data() { return { diff --git a/src/components/base/gallery/GalleryDeleteModal.vue b/src/components/base/gallery/GalleryDeleteModal.vue new file mode 100644 index 000000000..d360366b8 --- /dev/null +++ b/src/components/base/gallery/GalleryDeleteModal.vue @@ -0,0 +1,31 @@ + + + + + diff --git a/src/components/base/gallery/GalleryDrawer.vue b/src/components/base/gallery/GalleryDrawer.vue new file mode 100644 index 000000000..c5666acd1 --- /dev/null +++ b/src/components/base/gallery/GalleryDrawer.vue @@ -0,0 +1,196 @@ + + + + + + + diff --git a/src/components/base/gallery/GalleryForm.vue b/src/components/base/gallery/GalleryForm.vue new file mode 100644 index 000000000..64c3cb4ca --- /dev/null +++ b/src/components/base/gallery/GalleryForm.vue @@ -0,0 +1,211 @@ + + + + + + + + + diff --git a/src/components/base/gallery/GalleryItem.vue b/src/components/base/gallery/GalleryItem.vue new file mode 100644 index 000000000..bcd3aba78 --- /dev/null +++ b/src/components/base/gallery/GalleryItem.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/src/components/base/gallery/GalleryList.vue b/src/components/base/gallery/GalleryList.vue new file mode 100644 index 000000000..6578618ce --- /dev/null +++ b/src/components/base/gallery/GalleryList.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/components/group/GroupCard.vue b/src/components/group/GroupCard.vue index 6866870cd..d61f93bb3 100644 --- a/src/components/group/GroupCard.vue +++ b/src/components/group/GroupCard.vue @@ -4,6 +4,7 @@ :to-link="toLink" :data-test="`group-card-${group.name}`" :mode="mode" + :line-clamp="lineClamp" @click="toGroupPage" > - @@ -80,7 +73,7 @@ const confirmGroup = (group) => { .group-grid { display: grid; - grid-template-columns: 1fr 1fr; + grid-template-columns: 1fr; justify-items: stretch; gap: $space-l; } diff --git a/src/components/group/GroupForm/ProjectSection.vue b/src/components/group/GroupForm/ProjectSection.vue index 46b86026f..d17369531 100644 --- a/src/components/group/GroupForm/ProjectSection.vue +++ b/src/components/group/GroupForm/ProjectSection.vue @@ -15,14 +15,18 @@
- + @click="onRemoveProject(project)" + > + +
- - diff --git a/src/components/group/GroupHeader/GroupHeaderV2.vue b/src/components/group/GroupHeader/GroupHeaderV2.vue deleted file mode 100644 index 2fbdace4d..000000000 --- a/src/components/group/GroupHeader/GroupHeaderV2.vue +++ /dev/null @@ -1,166 +0,0 @@ - - - - - diff --git a/src/components/group/GroupPageInnerV2.vue b/src/components/group/GroupPageInnerV2.vue deleted file mode 100644 index c04c54918..000000000 --- a/src/components/group/GroupPageInnerV2.vue +++ /dev/null @@ -1,399 +0,0 @@ - - - - - diff --git a/src/components/group/GroupSelectDrawer/GroupSelectDrawer.vue b/src/components/group/GroupSelectDrawer/GroupSelectDrawer.vue index 5436cd9bf..2d63c407e 100644 --- a/src/components/group/GroupSelectDrawer/GroupSelectDrawer.vue +++ b/src/components/group/GroupSelectDrawer/GroupSelectDrawer.vue @@ -32,7 +32,7 @@ v-for="group in listGroups" :key="group.id" :group="group" - :has-add-icon="true" + has-add-icon :data-test="`drawer-group-card-${group.id}`" @add="selectGroup(group)" /> diff --git a/src/components/group/GroupsElement/GroupsElement.vue b/src/components/group/GroupsElement/GroupsElement.vue index afe1bb497..69ec3bd6b 100644 --- a/src/components/group/GroupsElement/GroupsElement.vue +++ b/src/components/group/GroupsElement/GroupsElement.vue @@ -72,7 +72,7 @@ const showChild = ref(false) const showChildren = () => (showChild.value = !showChild.value) const goTo = (group) => { - router.push({ name: 'Group', params: { groupId: group.slug || group.id } }) + router.push({ name: 'Group', params: { groupId: group.id } }) } const addGroup = (group) => emit('add', group) const editGroup = (group) => emit('edit', group) diff --git a/src/components/group/Map/GroupLocationToolTip.vue b/src/components/group/Map/GroupLocationToolTip.vue new file mode 100644 index 000000000..370b73cb7 --- /dev/null +++ b/src/components/group/Map/GroupLocationToolTip.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/components/group/Modules/BaseGroupPreview.vue b/src/components/group/Modules/BaseGroupPreview.vue new file mode 100644 index 000000000..bb9157ce0 --- /dev/null +++ b/src/components/group/Modules/BaseGroupPreview.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/components/group/Modules/Documents/GroupDocumentsPreview.vue b/src/components/group/Modules/Documents/GroupDocumentsPreview.vue new file mode 100644 index 000000000..360c697e4 --- /dev/null +++ b/src/components/group/Modules/Documents/GroupDocumentsPreview.vue @@ -0,0 +1,43 @@ + + + diff --git a/src/components/group/Modules/Extras/GroupDescriptionPreview.vue b/src/components/group/Modules/Extras/GroupDescriptionPreview.vue new file mode 100644 index 000000000..4e80a73d9 --- /dev/null +++ b/src/components/group/Modules/Extras/GroupDescriptionPreview.vue @@ -0,0 +1,18 @@ + + + diff --git a/src/components/group/Modules/Extras/GroupRecapPreview.vue b/src/components/group/Modules/Extras/GroupRecapPreview.vue new file mode 100644 index 000000000..5f93f07f0 --- /dev/null +++ b/src/components/group/Modules/Extras/GroupRecapPreview.vue @@ -0,0 +1,97 @@ + + + + + diff --git a/src/components/group/Modules/Extras/GroupSimilarDrawer.vue b/src/components/group/Modules/Extras/GroupSimilarDrawer.vue new file mode 100644 index 000000000..d988249c8 --- /dev/null +++ b/src/components/group/Modules/Extras/GroupSimilarDrawer.vue @@ -0,0 +1,69 @@ + + + + + diff --git a/src/components/group/Modules/Extras/GroupSimilarsPreview.vue b/src/components/group/Modules/Extras/GroupSimilarsPreview.vue new file mode 100644 index 000000000..78886aca1 --- /dev/null +++ b/src/components/group/Modules/Extras/GroupSimilarsPreview.vue @@ -0,0 +1,115 @@ + + + + + + + diff --git a/src/components/group/Modules/Gallery/BaseGroupGallery.vue b/src/components/group/Modules/Gallery/BaseGroupGallery.vue new file mode 100644 index 000000000..d81910b03 --- /dev/null +++ b/src/components/group/Modules/Gallery/BaseGroupGallery.vue @@ -0,0 +1,170 @@ + + + + + diff --git a/src/components/group/Modules/Gallery/GroupGalleryPreview.vue b/src/components/group/Modules/Gallery/GroupGalleryPreview.vue new file mode 100644 index 000000000..4d573b5e3 --- /dev/null +++ b/src/components/group/Modules/Gallery/GroupGalleryPreview.vue @@ -0,0 +1,32 @@ + + + diff --git a/src/components/group/Modules/GroupHeader.vue b/src/components/group/Modules/GroupHeader.vue new file mode 100644 index 000000000..6f630c922 --- /dev/null +++ b/src/components/group/Modules/GroupHeader.vue @@ -0,0 +1,255 @@ + + + + + + + diff --git a/src/components/group/Modules/GroupSub/GroupSubDrawer.vue b/src/components/group/Modules/GroupSub/GroupSubDrawer.vue new file mode 100644 index 000000000..5437b6c46 --- /dev/null +++ b/src/components/group/Modules/GroupSub/GroupSubDrawer.vue @@ -0,0 +1,29 @@ + + + diff --git a/src/components/group/Modules/GroupSub/GroupSubList.vue b/src/components/group/Modules/GroupSub/GroupSubList.vue new file mode 100644 index 000000000..903f3e597 --- /dev/null +++ b/src/components/group/Modules/GroupSub/GroupSubList.vue @@ -0,0 +1,57 @@ + + + + + diff --git a/src/components/group/Modules/GroupSub/GroupSubPreview.vue b/src/components/group/Modules/GroupSub/GroupSubPreview.vue new file mode 100644 index 000000000..99a9d989d --- /dev/null +++ b/src/components/group/Modules/GroupSub/GroupSubPreview.vue @@ -0,0 +1,34 @@ + + + diff --git a/src/components/group/Modules/GroupSub/GroupSubTeamItem.vue b/src/components/group/Modules/GroupSub/GroupSubTeamItem.vue new file mode 100644 index 000000000..1ec52e8a2 --- /dev/null +++ b/src/components/group/Modules/GroupSub/GroupSubTeamItem.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/components/group/Modules/Locations/GroupLocationBase.vue b/src/components/group/Modules/Locations/GroupLocationBase.vue new file mode 100644 index 000000000..e938f24e6 --- /dev/null +++ b/src/components/group/Modules/Locations/GroupLocationBase.vue @@ -0,0 +1,59 @@ + + + diff --git a/src/components/group/Modules/Locations/GroupLocationPreview.vue b/src/components/group/Modules/Locations/GroupLocationPreview.vue new file mode 100644 index 000000000..66edcd615 --- /dev/null +++ b/src/components/group/Modules/Locations/GroupLocationPreview.vue @@ -0,0 +1,33 @@ + + + diff --git a/src/components/group/Modules/Members/BaseGroupMembersList.vue b/src/components/group/Modules/Members/BaseGroupMembersList.vue new file mode 100644 index 000000000..231c28390 --- /dev/null +++ b/src/components/group/Modules/Members/BaseGroupMembersList.vue @@ -0,0 +1,85 @@ + + + + + + + diff --git a/src/components/group/Modules/Members/GroupMemberItem.vue b/src/components/group/Modules/Members/GroupMemberItem.vue new file mode 100644 index 000000000..f99e2dab3 --- /dev/null +++ b/src/components/group/Modules/Members/GroupMemberItem.vue @@ -0,0 +1,131 @@ + + + + + diff --git a/src/components/group/Modules/Members/GroupMembersPreview.vue b/src/components/group/Modules/Members/GroupMembersPreview.vue new file mode 100644 index 000000000..ba0aa6595 --- /dev/null +++ b/src/components/group/Modules/Members/GroupMembersPreview.vue @@ -0,0 +1,40 @@ + + + + + diff --git a/src/components/group/Modules/Projects/BaseGroupProjectsList.vue b/src/components/group/Modules/Projects/BaseGroupProjectsList.vue new file mode 100644 index 000000000..d301db62b --- /dev/null +++ b/src/components/group/Modules/Projects/BaseGroupProjectsList.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/components/group/Modules/Projects/GroupProjectsPreview.vue b/src/components/group/Modules/Projects/GroupProjectsPreview.vue new file mode 100644 index 000000000..c1ccfe084 --- /dev/null +++ b/src/components/group/Modules/Projects/GroupProjectsPreview.vue @@ -0,0 +1,34 @@ + + + + + diff --git a/src/components/group/SubGroups/SubGroups.vue b/src/components/group/SubGroups/SubGroups.vue deleted file mode 100644 index 62221b3dc..000000000 --- a/src/components/group/SubGroups/SubGroups.vue +++ /dev/null @@ -1,103 +0,0 @@ - - - - - diff --git a/src/components/group/SubGroups/SubGroupsSkeleton.vue b/src/components/group/SubGroups/SubGroupsSkeleton.vue deleted file mode 100644 index fa3f72971..000000000 --- a/src/components/group/SubGroups/SubGroupsSkeleton.vue +++ /dev/null @@ -1,29 +0,0 @@ - - - - - diff --git a/src/components/home/HomeButtons/HomeButtons.vue b/src/components/home/HomeButtons/HomeButtons.vue index f4bdfd7ff..a974e5d9d 100644 --- a/src/components/home/HomeButtons/HomeButtons.vue +++ b/src/components/home/HomeButtons/HomeButtons.vue @@ -1,5 +1,5 @@