forked from CharlieDigital/coderev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviewModels.ts
110 lines (95 loc) · 1.93 KB
/
viewModels.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/**
* This file holds view models which are only used on the front-end.
*/
import { ReviewComment } from "./domainModels"
import { MediaRef } from "./models"
/**
* Type used to represent user uploaded or created file.
*/
export type SourceFile = {
/**
* The extension with the leading .
*/
ext: string
/**
* The full name of the file including the extension.
*/
name: string
/**
* The text contents of the file.
*/
text: string,
/**
* The last hash for this file; check against this to see if there's a change
* in the contents.
*/
hash?: string
/**
* When present, this means that the file has a backing reference stored in
* Cloud Storage. If this value is undefined, then the file hasn't been saved
* yet.
*/
ref?: MediaRef
}
/**
* Represents a line selection in a source file.
*/
export type SourceSelection = {
/**
* The UID of the source reference.
*/
sourceUid: string;
/**
* The name of the source reference.
*/
sourceName: string;
/**
* The character index of the start of the selection.
*/
from: number;
/**
* The character index of the end of the selection.
*/
to: number;
/**
* The line index of the start of the selection.
*/
fromLine: number;
/**
* The line index of the en of the selection.
*/
toLine: number;
}
/**
* Corresponds to the Quasar menu positions.
*/
export type MenuPosition =
| "top left"
| "top middle"
| "top right"
| "top start"
| "top end"
| "center left"
| "center middle"
| "center right"
| "center start"
| "center end"
| "bottom left"
| "bottom middle"
| "bottom right"
| "bottom start"
| "bottom end"
| undefined;
/**
* Models a simple comment chain with one root comment.
*/
export type CommentChain = {
/**
* The root comment of the chain.
*/
rootComment: ReviewComment
/**
* An array of reply comments.
*/
replyComments: ReviewComment[]
}