forked from cozy-labs/cozy-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
details.js
202 lines (197 loc) · 4.83 KB
/
details.js
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
const React = require('react')
const ReactDOM = require('react-dom')
const PropTypes = require('prop-types')
const e = React.createElement
const em = content =>
e('span', { className: 'u-bg-frenchPass u-bdrs-4 u-ph-half u-pv-0' }, content)
const Details = props => {
const { translate, interpolate } = props
return e('div', { className: 'details' }, [
e('header', { className: 'details__header' }, [
e(
'h1',
null,
translate('InvalidDoc Naming rules for each Operating System')
)
]),
e('h2', null, translate('InvalidDoc Windows restrictions')),
e('ul', null, [
e(
'li',
{ key: 'nameLength' },
translate(
'InvalidDoc File names, extension included, cannot be more than 256 characters long.'
)
),
e(
'li',
{ key: 'dirNameLength' },
translate(
'InvalidDoc Folder names cannot be more than 243 characters long.'
)
),
e(
'li',
{ key: 'pathLength' },
interpolate(
translate(
"InvalidDoc Document paths (i.e. document name + all its ancestors' names) cannot be more than {0} characters long."
),
32766
)
),
e('li', { key: 'reservedChars' }, [
translate(
'InvalidDoc Document names cannot include the following characters: '
),
em('<'),
', ',
em('>'),
', ',
em(':'),
', ',
em('"'),
', ',
em('/'),
', ',
em('\\'),
', ',
em('|'),
', ',
em('?'),
', ',
em('*')
]),
e('li', { key: 'forbiddenLastChars' }, [
translate(
'InvalidDoc Folder names and file extensions cannot end with the following characters: '
),
em('.'),
', ',
em(' ')
]),
e('li', { key: 'reservedNames' }, [
translate('InvalidDoc The following document names are forbidden: '),
em('CON'),
', ',
em('PRN'),
', ',
em('AUX'),
', ',
em('NUL'),
', ',
em('COM1'),
', ',
em('COM2'),
', ',
em('COM3'),
', ',
em('COM4'),
', ',
em('COM5'),
', ',
em('COM6'),
', ',
em('COM7'),
', ',
em('COM8'),
', ',
em('COM9'),
', ',
em('LPT1'),
', ',
em('LPT2'),
', ',
em('LPT3'),
', ',
em('LPT4'),
', ',
em('LPT5'),
', ',
em('LPT6'),
', ',
em('LPT7'),
', ',
em('LPT8'),
', ',
em('LPT9')
])
]),
e('h2', null, translate('InvalidDoc macOS restrictions')),
e('ul', null, [
e(
'li',
{ key: 'nameLength' },
interpolate(
translate(
'InvalidDoc Document names, extension included, cannot be more than {0} characters long.'
),
255
)
),
e(
'li',
{ key: 'pathLength' },
interpolate(
translate(
"InvalidDoc Document paths (i.e. document name + all its ancestors' names) cannot be more than {0} characters long."
),
1023
)
),
e('li', { key: 'reservedChars' }, [
translate(
'InvalidDoc Document names cannot include the following characters: '
),
em('/')
])
]),
e('h2', null, translate('InvalidDoc Linux restrictions')),
e('ul', null, [
e(
'li',
{ key: 'nameLength' },
interpolate(
translate(
'InvalidDoc Document names, extension included, cannot be more than {0} characters long.'
),
255
)
),
e(
'li',
{ key: 'pathLength' },
interpolate(
translate(
"InvalidDoc Document paths (i.e. document name + all its ancestors' names) cannot be more than {0} characters long."
),
4095
)
),
e('li', { key: 'reservedChars' }, [
translate(
'InvalidDoc Document names cannot include the following characters: '
),
em('/')
])
])
])
}
Details.propTypes = {
translate: PropTypes.func.isRequired,
interpolate: PropTypes.func.isRequired
}
require('electron').ipcRenderer.on(
'load-content',
(event, { translations }) => {
const translate = key =>
translations[key] || key.substr(key.indexOf(' ') + 1) // Key without prefix
const interpolate = (string, ...args) => {
return string.replace(/{(\d+)}/g, (_, index) => args[parseInt(index)])
}
ReactDOM.render(
e(React.Fragment, null, [e(Details, { translate, interpolate }, null)]),
document.getElementById('container')
)
}
)