Skip to content

Commit b6fc214

Browse files
committed
fixed some bugs
1 parent 5840615 commit b6fc214

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

components/attributes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export default async function createAttributes(screen, menu) {
3434
width: '100%',
3535
height: '90%',
3636
noCellBorders: true,
37+
scrollbar: true,
38+
scrollable: true,
39+
label: 'Dados dos hospedeiros',
40+
mouse: true,
41+
keys: true,
3742
pad: 1,
3843
top: 'center',
3944
left: 'center',

components/menu.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ export default function createMenu(screen) {
3232
screen.append(options);
3333

3434
options.on('action', (item) => {
35-
const index = menuOptions.indexOf(item.content);
36-
const actions = [createForm, createAttributes, createDuck];
37-
const action = actions[index];
38-
options.hide();
39-
action(screen, options);
35+
try {
36+
const index = menuOptions.indexOf(item.content);
37+
const actions = [createForm, createAttributes, createDuck];
38+
const action = actions[index];
39+
options.hide();
40+
action(screen, options);
41+
} catch (error) {}
4042
});
4143

4244
options.focus();

db/closeDB.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import db from './getDB';
1+
import db from './getDB.js';
22

33
export default function closeDB() {
44
db.close();

main.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import blessed from 'blessed';
22
import createDB from './db/createDB.js';
33
import createMenu from './components/menu.js';
4-
4+
import closeDB from './db/closeDB.js';
55
createDB();
66

7-
const screen = blessed.screen({ smartCSR: true, title: 'DSIN Coderchallenge' });
7+
const screen = blessed.screen({
8+
smartCSR: true,
9+
title: 'DSIN Coder Challenge 2023',
10+
});
811

912
screen.key(['scape', 'C-c'], () => {
13+
closeDB();
14+
screen.destroy();
1015
return process.exit(0);
1116
});
1217

0 commit comments

Comments
 (0)