Skip to content

Commit 183f989

Browse files
committed
UI almost finished. Date created and date modified attributes added to metadata.
1 parent cbfc0c2 commit 183f989

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

src/CodeSnippetContentsService.ts

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export interface ICodeSnippet {
88
code: string[];
99
id: number;
1010
tags?: string[];
11+
date_created?: string;
12+
date_modified?: string;
1113
}
1214

1315
/**

src/CodeSnippetInputDialog.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ export function CodeSnippetInputDialog(
9898
language: result.value[2],
9999
code: code,
100100
id: idx,
101-
tags: tags
101+
tags: tags,
102+
date_created: new Date().toLocaleString()
102103
};
103104
const contentsService = CodeSnippetContentsService.getInstance();
104105
const currSnippets = codeSnippetWidget.codeSnippetWidgetModel.snippets;

src/SortTools.tsx

+22-18
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ const SORT_ICON_ACTIVE = 'jp-codeSnippet-sort-icon-active';
1111
const CODE_SNIPPET_SORT_CONTENT = 'jp-codeSnippet-sort-content';
1212
const CODE_SNIPPET_SORT_SORTBY = 'jp-codeSnippet-sort-sortby';
1313
const CODE_SNIPPET_SORT_OPTION = 'jp-codeSnippet-sort-option';
14+
// const CODE_SNIPPET_SORT_SELECTED = 'jp-codeSnippet-sort-selected';
1415

1516
/* Add on click to span and then create function to actually do the sorting*/
1617
/* Right now the coloring of the arrows is off, make sure when dialog disappears arrow turns back to gray*/
18+
/* Add innerHTML for the checkmark when something is clicked. When its clicked again remove the checkmark. */
1719

1820
class OptionsHandler extends Widget {
1921
constructor(display: SortTools) {
@@ -49,27 +51,29 @@ export class SortTools extends React.Component {
4951
body.className = 'jp-codeSnippet-sort-test-container';
5052
const optionsContainer = document.createElement('div');
5153
optionsContainer.className = CODE_SNIPPET_SORT_CONTENT;
52-
const insertSnip = document.createElement('div');
53-
insertSnip.className = CODE_SNIPPET_SORT_SORTBY;
54-
// 4 space start to sortby
55-
insertSnip.textContent = ' Sort by:';
56-
/*insertSnip.onclick = (): void => {};*/
57-
const copySnip = document.createElement('div');
58-
copySnip.className = CODE_SNIPPET_SORT_OPTION;
59-
copySnip.textContent = ' Last Modified';
54+
const sortBy = document.createElement('div');
55+
sortBy.className = CODE_SNIPPET_SORT_SORTBY;
56+
// 4 space start
57+
sortBy.textContent = ' Sort by:';
58+
const lastMod = document.createElement('div');
59+
lastMod.className = CODE_SNIPPET_SORT_OPTION;
60+
// const checkMark = document.createElement('span');
61+
// checkMark.className = CODE_SNIPPET_SORT_SELECTED;
62+
// copySnip.appendChild(checkMark);
63+
lastMod.textContent = ' Last Modified';
6064
/*copySnip.onclick = (): void => {};*/
61-
const editSnip = document.createElement('div');
62-
editSnip.className = CODE_SNIPPET_SORT_OPTION;
63-
editSnip.textContent = ' Date Created: Newest';
65+
const createNew = document.createElement('div');
66+
createNew.className = CODE_SNIPPET_SORT_OPTION;
67+
createNew.textContent = ' Date Created: Newest';
6468
/*editSnip.onclick = (): void => {};*/
65-
const deleteSnip = document.createElement('div');
66-
deleteSnip.className = CODE_SNIPPET_SORT_OPTION;
67-
deleteSnip.textContent = ' Date Created: Oldest';
69+
const createOld = document.createElement('div');
70+
createOld.className = CODE_SNIPPET_SORT_OPTION;
71+
createOld.textContent = ' Date Created: Oldest';
6872
/*deleteSnip.onclick = (): void => {};*/
69-
optionsContainer.appendChild(insertSnip);
70-
optionsContainer.appendChild(copySnip);
71-
optionsContainer.appendChild(editSnip);
72-
optionsContainer.appendChild(deleteSnip);
73+
optionsContainer.appendChild(sortBy);
74+
optionsContainer.appendChild(lastMod);
75+
optionsContainer.appendChild(createNew);
76+
optionsContainer.appendChild(createOld);
7377
body.append(optionsContainer);
7478
return body;
7579
}

0 commit comments

Comments
 (0)