Skip to content
28 changes: 14 additions & 14 deletions src/Api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ export type ApiEmailAdressList = {
combined: string
}

export { default as ActivityAPI } from './modules/activity.ts'
export { default as AdminAPI } from './modules/admin.ts'
export { default as AppSettingsAPI } from './modules/appSettings.ts'
export { default as CalendarAPI } from './modules/calendar.ts'
export { default as CommentsAPI } from './modules/comments.ts'
export { default as OptionsAPI } from './modules/options.ts'
export { default as PollsAPI } from './modules/polls.ts'
export { default as PollGroupsAPI } from './modules/pollGroups.ts'
export { default as PublicAPI } from './modules/public.ts'
export { default as SharesAPI } from './modules/shares.ts'
export { default as UserSettingsAPI } from './modules/userSettings.ts'
export { default as ValidatorAPI } from './modules/validators.ts'
export { default as VotesAPI } from './modules/votes.ts'
export { default as SessionAPI } from './modules/session.ts'
export { default as ActivityAPI } from './modules/activity'
export { default as AdminAPI } from './modules/admin'
export { default as AppSettingsAPI } from './modules/appSettings'
export { default as CalendarAPI } from './modules/calendar'
export { default as CommentsAPI } from './modules/comments'
export { default as OptionsAPI } from './modules/options'
export { default as PollsAPI } from './modules/polls'
export { default as PollGroupsAPI } from './modules/pollGroups'
export { default as PublicAPI } from './modules/public'
export { default as SharesAPI } from './modules/shares'
export { default as UserSettingsAPI } from './modules/userSettings'
export { default as ValidatorAPI } from './modules/validators'
export { default as VotesAPI } from './modules/votes'
export { default as SessionAPI } from './modules/session'
1 change: 0 additions & 1 deletion src/Api/modules/HttpApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import axios from '@nextcloud/axios'
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
import { useSessionStore } from '../../stores/session.ts'
// const clientSessionId = Math.random().toString(36).substring(2)

const axiosConfig = {
baseURL: generateUrl('apps/polls/'),
Expand Down
2 changes: 1 addition & 1 deletion src/Api/modules/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { ocsInstance, createCancelTokenHandler } from './HttpApi.js'
import { ocsInstance, createCancelTokenHandler } from './HttpApi'

const activity = {
getActivities(pollId: number) {
Expand Down
2 changes: 1 addition & 1 deletion src/Api/modules/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

const adminJobs = {
runAutoReminder() {
Expand Down
12 changes: 11 additions & 1 deletion src/Api/modules/api.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,17 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

import { Comment, Option, Poll, Share, Vote } from '../../Types'
import type { Option } from '../../stores/options.types'
import type { Vote } from '../../stores/votes.types'
import type { Poll } from '../../stores/poll.types'
import type { Comment } from '../../stores/comments.types'
import type { Share } from '../../stores/shares.types'

export type ApiEmailAdressList = {
displayName: string
emailAddress: string
combined: string
}

export type FullPollResponse = {
poll: Poll
Expand Down
15 changes: 8 additions & 7 deletions src/Api/modules/appSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { AppSettings, Group } from '../../stores/appSettings.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { ISearchType, User } from '../../Types/index.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'
import { ISearchType, User } from '../../Types'

import type { AxiosResponse } from '@nextcloud/axios'
import type { AppSettingsStore, Group } from '../../stores/appSettings.types'

const appSettings = {
getAppSettings(): Promise<AxiosResponse<{ appSettings: AppSettings }>> {
getAppSettings(): Promise<AxiosResponse<{ appSettings: AppSettingsStore }>> {
return httpInstance.request({
method: 'GET',
url: 'settings/app',
Expand All @@ -21,8 +22,8 @@ const appSettings = {
},

writeAppSettings(
appSettings: AppSettings,
): Promise<AxiosResponse<{ appSettings: AppSettings }>> {
appSettings: AppSettingsStore,
): Promise<AxiosResponse<{ appSettings: AppSettingsStore }>> {
return httpInstance.request({
method: 'POST',
url: 'settings/app',
Expand Down
7 changes: 4 additions & 3 deletions src/Api/modules/calendar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { Calendar } from '../../stores/preferences.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'
import { CalendarEvent } from '../../components/Calendar/CalendarPeek.vue'

import type { AxiosResponse } from '@nextcloud/axios'
import type { Calendar } from '../../stores/preferences.types'

const calendar = {
getCalendars(): Promise<AxiosResponse<{ calendars: Calendar[] }>> {
return httpInstance.request({
Expand Down
5 changes: 3 additions & 2 deletions src/Api/modules/comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { Comment } from '../../stores/comments.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { Comment } from '../../stores/comments.types'

const comments = {
getComments(pollId: number): Promise<AxiosResponse<{ comments: Comment[] }>> {
Expand Down
11 changes: 6 additions & 5 deletions src/Api/modules/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { Option, Sequence, SimpleOption } from '../../stores/options.js'
import { DateTimeUnit } from '../../constants/dateUnits.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { AxiosResponse } from '@nextcloud/axios'
import { Vote } from '../../stores/votes.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { DateTimeUnit } from '../../constants/dateUnits'
import type { AxiosResponse } from '@nextcloud/axios'
import type { Vote } from '../../stores/votes.types'
import type { Option, Sequence, SimpleOption } from '../../stores/options.types'

const options = {
getOptions(pollId: number): Promise<AxiosResponse<{ options: Option[] }>> {
Expand Down
9 changes: 5 additions & 4 deletions src/Api/modules/pollGroups.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { Poll } from '../../stores/poll.ts'
import { PollGroup } from '../../stores/pollGroups.types.ts'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { AxiosResponse } from '@nextcloud/axios'
import type { Poll } from '../../stores/poll.types'
import type { PollGroup } from '../../stores/pollGroups.types'

const pollGroups = {
getPollGroups(): Promise<AxiosResponse<{ pollGroups: PollGroup[] }>> {
Expand Down
12 changes: 6 additions & 6 deletions src/Api/modules/polls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { Poll, PollConfiguration, PollType } from '../../stores/poll.ts'
import { AxiosResponse } from '@nextcloud/axios'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { ApiEmailAdressList } from '../../Types/index.ts'
import { PollGroup } from '../../stores/pollGroups.types.ts'
import { FullPollResponse } from './api.types.ts'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { AxiosResponse } from '@nextcloud/axios'
import type { ApiEmailAdressList, FullPollResponse } from './api.types'
import type { PollGroup } from '../../stores/pollGroups.types'
import type { Poll, PollConfiguration, PollType } from '../../stores/poll.types'

export type Confirmations = {
sentMails: { emailAddress: string; displayName: string }[]
Expand Down
22 changes: 12 additions & 10 deletions src/Api/modules/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { Option, Sequence, SimpleOption } from '../../stores/options.js'
import { Session } from '../../stores/session.js'
import { Answer, Vote } from '../../stores/votes.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { Comment } from '../../stores/comments.js'
import { Share } from '../../stores/shares.js'
import { SentResults } from './shares.js'
import {
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { SentResults } from './shares'
import type { AxiosResponse } from '@nextcloud/axios'
import type { Session } from '../../stores/session.types'
import type { Comment } from '../../stores/comments.types'
import type { Share } from '../../stores/shares.types'
import type { Option, Sequence, SimpleOption } from '../../stores/options.types'
import type { Answer, Vote } from '../../stores/votes.types'

import type {
AddOptionResponse,
FullPollResponse,
RemoveVotesResponse,
setVoteResponse,
} from './api.types.js'
} from './api.types'

const publicPoll = {
getPoll(shareToken: string): Promise<AxiosResponse<FullPollResponse>> {
Expand Down
7 changes: 4 additions & 3 deletions src/Api/modules/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { Session } from '../../stores/session.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { AxiosResponse } from '@nextcloud/axios'
import type { Session } from '../../stores/session.types'

const session = {
getSession(): Promise<AxiosResponse<Session>> {
Expand Down
14 changes: 10 additions & 4 deletions src/Api/modules/shares.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { Share, ShareType, User } from '../../Types/index.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { PublicPollEmailConditions, SharePurpose } from '../../stores/shares.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { AxiosResponse } from '@nextcloud/axios'
import type { User } from '../../Types'
import type {
PublicPollEmailConditions,
SharePurpose,
Share,
ShareType,
} from '../../stores/shares.types'

export type SentResults = {
sentMails: { emailAddress: string; displayName: string }[]
Expand Down
7 changes: 4 additions & 3 deletions src/Api/modules/userSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { UserPreferences } from '../../stores/preferences.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { AxiosResponse } from '@nextcloud/axios'
import type { UserPreferences } from '../../stores/preferences.types'

const userSettings = {
getUserSettings(): Promise<AxiosResponse<{ preferences: UserPreferences }>> {
Expand Down
5 changes: 3 additions & 2 deletions src/Api/modules/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { AxiosResponse } from '@nextcloud/axios'

const validators = {
validateEmailAddress(
Expand Down
9 changes: 5 additions & 4 deletions src/Api/modules/votes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
* SPDX-FileCopyrightText: 2022 Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import { AxiosResponse } from '@nextcloud/axios'
import { Answer, Vote } from '../../stores/votes.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi.js'
import { RemoveVotesResponse, setVoteResponse } from './api.types.js'
import { httpInstance, createCancelTokenHandler } from './HttpApi'

import type { RemoveVotesResponse, setVoteResponse } from './api.types'
import type { AxiosResponse } from '@nextcloud/axios'
import type { Answer, Vote } from '../../stores/votes.types'

const votes = {
getVotes(pollId: number): Promise<AxiosResponse<{ votes: Vote[] }>> {
Expand Down
25 changes: 18 additions & 7 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,28 @@
-->

<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted, watchEffect } from 'vue'
import { debounce } from 'lodash'
import {
ref,
computed,
defineAsyncComponent,
onMounted,
onUnmounted,
watchEffect,
} from 'vue'
import debounce from 'lodash/debounce'
import { subscribe, unsubscribe } from '@nextcloud/event-bus'

import NcContent from '@nextcloud/vue/components/NcContent'

import UserSettingsDlg from './components/Settings/UserSettingsDlg.vue'
// import UserSettingsDlg from './components/Settings/UserSettingsDlg.vue'

import { usePollWatcher } from './composables/usePollWatcher'

import { useSessionStore } from './stores/session.ts'
import { usePollStore } from './stores/poll.ts'
import { usePollGroupsStore } from './stores/pollGroups.ts'
import { useSessionStore } from './stores/session'
import { usePollStore } from './stores/poll'
import { usePollGroupsStore } from './stores/pollGroups'
import { showSuccess } from '@nextcloud/dialogs'
import { Event } from './Types/index.ts'
import { Event } from './Types'

import '@nextcloud/dialogs/style.css'
import './assets/scss/vars.scss'
Expand All @@ -43,6 +50,10 @@ const appClass = computed(() => [
},
])

const UserSettingsDlg = defineAsyncComponent(
() => import('./components/Settings/UserSettingsDlg.vue'),
)

const useNavigation = computed(() => sessionStore.userStatus.isLoggedin)
const useSidebar = computed(
() =>
Expand Down
Loading