Skip to content

Commit c969c9b

Browse files
CedricJeanseveibar
andauthored
fix: Add an option for deleting a file in the localStorage (#70)
* ajout icône de poubelle pour la suppression d'un fichier local * ajout de la fonction callback * retrait de la valeur à supprimer de recentItems * nettoyage du localstorage * tentative de hook * Callback => Function normal et abandon de la tentative * Ajustement du menu lors de la suppression * Suppression d'un enregistrement (pas TOUS) * Nettoyage du code suite au conseil l'admin * dépendance manquante * Changement de Prettier * Delete yarn.lock Co-authored-by: Severin Ibarluzea <[email protected]>
1 parent f3d9fef commit c969c9b

File tree

15 files changed

+103
-15636
lines changed

15 files changed

+103
-15636
lines changed

.babelrc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"presets": [
3-
[ "react-app", { "absoluteRuntime": false } ]
4-
]
2+
"presets": [["react-app", { "absoluteRuntime": false }]]
53
}

.storybook/addons.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
import '@storybook/addon-actions/register';
2-
import '@storybook/addon-links/register';
1+
import "@storybook/addon-actions/register"
2+
import "@storybook/addon-links/register"

.storybook/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import React from "react"
22
import { configure, addDecorator } from "@storybook/react"
33
import Theme from "../src/components/Theme"
44

5-
export const themeDecorator = storyFn => {
5+
export const themeDecorator = (storyFn) => {
66
// TODO wrap w/ theme
77
return React.createElement(Theme, {}, storyFn())
88
}
99

1010
function loadStories() {
1111
addDecorator(themeDecorator)
12-
const importAll = r => r.keys().map(r)
12+
const importAll = (r) => r.keys().map(r)
1313
importAll(require.context("../src/components", true, /\.story\.js$/))
1414
}
1515

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ Download the latest release from the [releases page](https://github.com/Universa
6363

6464
## Contributing
6565

66-
* (Optional) Say hi in the [Slack channel](https://join.slack.com/t/universaldatatool/shared_invite/zt-d8teykwi-iOSOUfxugKR~M4AJN6VL3g)!
67-
* Read [this guide to get started with development](https://github.com/UniversalDataTool/universal-data-tool/wiki/Setup-for-Development).
66+
- (Optional) Say hi in the [Slack channel](https://join.slack.com/t/universaldatatool/shared_invite/zt-d8teykwi-iOSOUfxugKR~M4AJN6VL3g)!
67+
- Read [this guide to get started with development](https://github.com/UniversalDataTool/universal-data-tool/wiki/Setup-for-Development).
6868

6969
## Libraries
7070

desktop/main.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ function createWindow() {
1212
height: 800,
1313
webPreferences: {
1414
nodeIntegration: true,
15-
webSecurity: false
15+
webSecurity: false,
1616
// preload: path.join(__dirname, "preload.js")
17-
}
17+
},
1818
})
1919

2020
const menu = Menu.buildFromTemplate(menuTemplate)
@@ -28,7 +28,7 @@ function createWindow() {
2828
formatUrl({
2929
pathname: path.join(__dirname, "../build", "index.html"),
3030
protocol: "file",
31-
slashes: true
31+
slashes: true,
3232
})
3333
)
3434
}
@@ -43,13 +43,13 @@ function createWindow() {
4343
app.on("ready", createWindow)
4444

4545
// Quit when all windows are closed.
46-
app.on("window-all-closed", function() {
46+
app.on("window-all-closed", function () {
4747
// On macOS it is common for applications and their menu bar
4848
// to stay active until the user quits explicitly with Cmd + Q
4949
if (process.platform !== "darwin") app.quit()
5050
})
5151

52-
app.on("activate", function() {
52+
app.on("activate", function () {
5353
// On macOS it's common to re-create a window in the app when the
5454
// dock icon is clicked and there are no other windows open.
5555
if (BrowserWindow.getAllWindows().length === 0) createWindow()

desktop/menu-template.js

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,49 +14,49 @@ module.exports = [
1414
label: "Empty",
1515
click: (menuItem, currentWindow) => {
1616
currentWindow.webContents.send("new-file", {})
17-
}
17+
},
1818
},
1919
{
2020
label: "Computer Vision",
2121
click: (menuItem, currentWindow) => {
2222
currentWindow.webContents.send("new-file", {
23-
templateName: menuItem.label
23+
templateName: menuItem.label,
2424
})
25-
}
25+
},
2626
},
2727
{
2828
label: "Data Entry",
2929
click: (menuItem, currentWindow) => {
3030
currentWindow.webContents.send("new-file", {
31-
templateName: menuItem.label
31+
templateName: menuItem.label,
3232
})
33-
}
33+
},
3434
},
3535
{
3636
label: "Natural Language",
3737
click: (menuItem, currentWindow) => {
3838
currentWindow.webContents.send("new-file", {
39-
templateName: menuItem.label
39+
templateName: menuItem.label,
4040
})
41-
}
41+
},
4242
},
4343
{
4444
label: "Audio Transcription",
4545
click: (menuItem, currentWindow) => {
4646
currentWindow.webContents.send("new-file", {
47-
templateName: menuItem.label
47+
templateName: menuItem.label,
4848
})
49-
}
49+
},
5050
},
5151
{
5252
label: "Composite",
5353
click: (menuItem, currentWindow) => {
5454
currentWindow.webContents.send("new-file", {
55-
templateName: menuItem.label
55+
templateName: menuItem.label,
5656
})
57-
}
58-
}
59-
]
57+
},
58+
},
59+
],
6060
},
6161
{
6262
role: "open",
@@ -70,69 +70,69 @@ module.exports = [
7070
currentWindow.webContents.send("open-file", {
7171
name: path.basename(filePaths[0]),
7272
path: filePaths[0],
73-
content: fs.readFileSync(filePaths[0]).toString()
73+
content: fs.readFileSync(filePaths[0]).toString(),
7474
})
7575
})
76-
}
76+
},
7777
},
7878
{
7979
role: "copy",
8080
label: "Copy",
8181
accelerator: "CommandOrControl+C",
82-
selector: "copy:"
82+
selector: "copy:",
8383
},
8484
{
8585
role: "paste",
8686
label: "Paste",
8787
accelerator: "CommandOrControl+V",
88-
selector: "paste:"
88+
selector: "paste:",
8989
},
9090
{
9191
role: "selectAll",
9292
label: "Select All",
9393
accelerator: "CommandOrControl+A",
94-
selector: "selectAll:"
94+
selector: "selectAll:",
9595
},
9696
{
9797
role: "cut",
9898
label: "Cut",
9999
accelerator: "CommandOrControl+X",
100-
selector: "cut:"
100+
selector: "cut:",
101101
},
102102
{
103103
role: "undo",
104104
label: "Undo",
105105
accelerator: "CommandOrControl+Z",
106-
selector: "undo:"
106+
selector: "undo:",
107107
},
108108
{
109109
role: "save",
110110
accelerator: "CommandOrControl+S",
111111
label: "Save",
112112
click: (menuItem, currentWindow) => {
113113
currentWindow.webContents.send("save-file")
114-
}
114+
},
115115
},
116116
{
117117
role: "save",
118118
accelerator: "CommandOrControl+Shift+S",
119119
label: "Save As",
120120
click: (menuItem, currentWindow) => {
121121
currentWindow.webContents.send("save-file-as")
122-
}
122+
},
123123
},
124124
{
125125
role: "export",
126126
label: "Export CSV",
127127
click: (menuItem, currentWindow) => {
128128
currentWindow.webContents.send("export-to-csv")
129-
}
129+
},
130130
},
131131
{ type: "separator" },
132132
{
133-
role: "quit"
134-
}
135-
]
133+
role: "quit",
134+
},
135+
],
136136
},
137137
{
138138
label: "Edit",
@@ -141,33 +141,33 @@ module.exports = [
141141
role: "copy",
142142
label: "Copy",
143143
accelerator: "CommandOrControl+C",
144-
selector: "copy:"
144+
selector: "copy:",
145145
},
146146
{
147147
role: "paste",
148148
label: "Paste",
149149
accelerator: "CommandOrControl+V",
150-
selector: "paste:"
150+
selector: "paste:",
151151
},
152152
{
153153
role: "selectAll",
154154
label: "Select All",
155155
accelerator: "CommandOrControl+A",
156-
selector: "selectAll:"
156+
selector: "selectAll:",
157157
},
158158
{
159159
role: "cut",
160160
label: "Cut",
161161
accelerator: "CommandOrControl+X",
162-
selector: "cut:"
162+
selector: "cut:",
163163
},
164164
{
165165
role: "undo",
166166
label: "Undo",
167167
accelerator: "CommandOrControl+Z",
168-
selector: "undo:"
168+
selector: "undo:",
169169
},
170-
]
170+
],
171171
},
172172
{
173173
label: "Navigate",
@@ -176,9 +176,9 @@ module.exports = [
176176
label: "Welcome Page",
177177
click: (menuItem, currentWindow) => {
178178
currentWindow.webContents.send("open-welcome-page")
179-
}
180-
}
181-
]
179+
},
180+
},
181+
],
182182
},
183183
{
184184
label: "About",
@@ -189,12 +189,12 @@ module.exports = [
189189
shell.openItem(
190190
"https://github.com/openhumanannotation/universal-data-tool"
191191
)
192-
}
193-
}
194-
]
192+
},
193+
},
194+
],
195195
},
196196
{
197197
label: "Debug",
198-
submenu: [{ role: "reload" }, { role: "toggledevtools" }]
199-
}
198+
submenu: [{ role: "reload" }, { role: "toggledevtools" }],
199+
},
200200
]

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"rfc6902": "^3.0.4",
8989
"seamless-immutable": "^7.1.4",
9090
"seed-random": "^2.2.0",
91+
"seedrandom": "^3.0.5",
9192
"styled-components": "^5.0.0",
9293
"use-event-callback": "^0.1.0",
9394
"ytdl-core": "^2.0.1"

public/legal.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ <h1>Universal Data Tool</h1>
2222
</div>
2323
<div
2424
id="terms-and-conditions-wrapper"
25-
style="padding-right: 5vw;padding-left: 5vw;padding-top: 2vh;"
25+
style="padding-right: 5vw; padding-left: 5vw; padding-top: 2vh;"
2626
>
2727
<h1>Terms and Conditions of Use</h1>
2828
<h3>1. Terms</h3>

src/components/ConfigureAudioTranscription/index.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const languages = [
7777
{ value: "id", text: "Indonesian" },
7878
{
7979
value: "ia",
80-
text: "Interlingua (International Auxiliary Language Association)"
80+
text: "Interlingua (International Auxiliary Language Association)",
8181
},
8282
{ value: "ie", text: "Interlingue" },
8383
{ value: "iu", text: "Inuktitut" },
@@ -189,7 +189,7 @@ const languages = [
189189
{ value: "yi", text: "Yiddish" },
190190
{ value: "yo", text: "Yoruba" },
191191
{ value: "za", text: "Zhuang, Chuang" },
192-
{ value: "zu", text: "Zulu" }
192+
{ value: "zu", text: "Zulu" },
193193
]
194194

195195
const form = {
@@ -198,32 +198,32 @@ const form = {
198198
name: "transcriptionType",
199199
title: "Transcription Type",
200200
type: "dropdown",
201-
choices: ["simple", "proper"]
201+
choices: ["simple", "proper"],
202202
},
203203
{
204204
name: "phraseBank",
205205
title: "Phrase Bank",
206206
description: "URL of single-column CSV or TXT file with allowed phrases",
207-
type: "text"
207+
type: "text",
208208
},
209209
{
210210
name: "onlyUseWordsInPhraseBank",
211211
title: "Only Use Words In Phrase Bank",
212-
type: "boolean"
212+
type: "boolean",
213213
},
214214
{
215215
name: "language",
216216
title: "Language",
217217
type: "dropdown",
218218
// https://gist.github.com/DimazzzZ/4e2a5a6c8c6f67900091#gistcomment-2858621
219-
choices: languages
219+
choices: languages,
220220
},
221221
{
222222
name: "description",
223223
title: "Description",
224-
type: "multiline-text"
225-
}
226-
]
224+
type: "multiline-text",
225+
},
226+
],
227227
}
228228

229229
export default ({ iface, onChange }) => {

src/components/Header/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import HeaderDrawer from "../HeaderDrawer"
88

99
export const HeaderContext = createContext({
1010
recentItems: [],
11+
changeRecentItems: () => null,
1112
onClickTemplate: () => null,
1213
onClickHome: () => null,
1314
onOpenFile: () => null,
@@ -58,6 +59,7 @@ export default ({
5859
onCloseDrawer={onCloseDrawer}
5960
onClickHome={headerContext.onClickHome}
6061
recentItems={headerContext.recentItems}
62+
changeRecentItems={headerContext.changeRecentItems}
6163
onOpenFile={headerContext.onOpenFile}
6264
onClickTemplate={headerContext.onClickTemplate}
6365
onOpenRecentItem={headerContext.onOpenRecentItem}

0 commit comments

Comments
 (0)