* ui: start highlight ui * ui: tag items * ui: connecting highlights to notes api... * Highlight feature refinements (#2948) * ui: move clips player to foss, connect notes api to hl * ui: tune note/hl editing, prevent zoom slider body from jumping around * ui: safe check for tag * ui: fix thumbnail gen * ui: fix thumbnail gen * ui: make player modal wider, add shadow * ui: custom warn barge for clips * ui: swap icon for note event wrapper * ui: rm other, fix cancel * ui: moving around creation modal * ui: bg tint * ui: rm disabled for text btn * ui: fix ownership sorting * ui: close player on bg click * ui: fix query, fix min distance for default range * ui: move hl list header out of list comp * ui: spot list header segmented size * Various improvements in highlights (#2955) * ui: update hl in hlPanel comp * ui: rm debug * ui: fix icons file --------- Co-authored-by: Sudheer Salavadi <connect.uxmaster@gmail.com>
116 lines
2.6 KiB
TypeScript
116 lines
2.6 KiB
TypeScript
import APIClient from 'App/api_client';
|
|
|
|
|
|
export const tagProps = {
|
|
'ISSUE': 'red',
|
|
'DESIGN': 'geekblue',
|
|
'NOTE': 'purple',
|
|
}
|
|
|
|
export type iTag = keyof typeof tagProps | "ALL"
|
|
|
|
export const TAGS = Object.keys(tagProps) as unknown as (keyof typeof tagProps)[]
|
|
|
|
export interface WriteNote {
|
|
message: string
|
|
tag: string
|
|
isPublic: boolean
|
|
timestamp?: number
|
|
startAt: number
|
|
endAt: number
|
|
thumbnail: string
|
|
}
|
|
|
|
export interface Note {
|
|
createdAt: string
|
|
deletedAt: string | null
|
|
isPublic: boolean
|
|
message: string
|
|
noteId: number
|
|
projectId: number
|
|
sessionId: string
|
|
tag: iTag
|
|
timestamp: number
|
|
userId: number
|
|
userName: string
|
|
startAt: number
|
|
endAt: number
|
|
thumbnail: string
|
|
}
|
|
|
|
export interface NotesFilter {
|
|
page: number
|
|
limit: number
|
|
sort: string
|
|
order: 'DESC' | 'ASC'
|
|
tags: iTag[]
|
|
sharedOnly: boolean
|
|
mineOnly: boolean
|
|
search: string
|
|
}
|
|
|
|
export default class NotesService {
|
|
private client: APIClient;
|
|
|
|
constructor(client?: APIClient) {
|
|
this.client = client ? client : new APIClient();
|
|
}
|
|
|
|
initClient(client?: APIClient) {
|
|
this.client = client || new APIClient();
|
|
}
|
|
|
|
fetchNotes(filter: NotesFilter): Promise<{ notes: Note[], count: number }> {
|
|
return this.client.post('/notes', filter).then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
|
|
fetchNoteById(noteId: string): Promise<Note> {
|
|
return this.client.get(`/notes/${noteId}`).then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
|
|
getNotesBySessionId(sessionID: string): Promise<Note[]> {
|
|
return this.client.get(`/sessions/${sessionID}/notes`)
|
|
.then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
|
|
addNote(sessionID: string, note: WriteNote): Promise<Note> {
|
|
return this.client.post(`/sessions/${sessionID}/notes`, note)
|
|
.then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
|
|
updateNote(noteID: string, note: WriteNote): Promise<Note> {
|
|
return this.client.post(`/notes/${noteID}`, note)
|
|
.then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
|
|
deleteNote(noteID: number) {
|
|
return this.client.delete(`/notes/${noteID}`)
|
|
.then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
|
|
sendSlackNotification(noteId: string, webhook: string) {
|
|
return this.client.get(`/notes/${noteId}/slack/${webhook}`)
|
|
.then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
|
|
sendMsTeamsNotification(noteId: string, webhook: string) {
|
|
return this.client.get(`/notes/${noteId}/msteams/${webhook}`)
|
|
.then(r => {
|
|
return r.json().then(r => r.data)
|
|
})
|
|
}
|
|
}
|