aboutsummaryrefslogtreecommitdiff
path: root/src/renderer.ts
diff options
context:
space:
mode:
authorPriyansh <[email protected]>2021-04-27 20:42:13 +0530
committerPriyansh <[email protected]>2021-04-27 20:42:13 +0530
commita8edac4105f007003c3f244b482d03732ce74398 (patch)
tree1440e377da6b4ba18ca3151066efbafeed7a9c06 /src/renderer.ts
parentb18cf71249b26d965215bcf06204daf6af5f55e7 (diff)
downloadstyx-a8edac4105f007003c3f244b482d03732ce74398.tar.xz
styx-a8edac4105f007003c3f244b482d03732ce74398.zip
Preferences + List FavoritesHEADmaster
Diffstat (limited to 'src/renderer.ts')
-rw-r--r--src/renderer.ts30
1 files changed, 23 insertions, 7 deletions
diff --git a/src/renderer.ts b/src/renderer.ts
index d3a21bc..33cfdef 100644
--- a/src/renderer.ts
+++ b/src/renderer.ts
@@ -1,12 +1,28 @@
import systemLevelInformation from './systemLevelInformation';
+import Preferences from './Preferences';
-// Listing Files in Home Directory
+// List all the favourites
-const currentHomeDir: string = systemLevelInformation.getUserInfo().homedir;
-document.getElementById('username').innerHTML = systemLevelInformation.getUserInfo().username;
+Preferences.getFavourites().forEach(favourite => {
+ const favourites = document.getElementById('favourites');
+ const listElement = document.createElement('li');
+ const iconElement = document.createElement('i');
+ iconElement.classList.add(favourite.icon);
+ listElement.appendChild(iconElement);
+ const spanElement = document.createElement('span');
+ spanElement.innerHTML = favourite.text;
+ listElement.appendChild(spanElement);
+ listElement.setAttribute('path', favourite.path);
+ if (Preferences.getConfiguredPathToDisplayAfterAppInit() === favourite.path) {
+ listElement.classList.add('selected');
+ displayDirectoryViaElement(listElement);
+ }
+ favourites.appendChild(listElement);
+});
-// This variable will keep track of current path
-var currentDirectoryPath: string = currentHomeDir;
-
-const currentHomeFolders: any = systemLevelInformation.getAllFilesOfDirectory(currentHomeDir);
+function displayDirectoryViaElement(element: HTMLElement) {
+ // Listing Files in the Directory
+ const currentFolders: any = systemLevelInformation.getAllFilesOfDirectory(element.getAttribute('path'));
+ console.log(currentFolders);
+}