diff --git a/src/assets/conf/resources-landing-page.json b/src/assets/conf/resources-landing-page.json new file mode 100644 index 0000000..28fd664 --- /dev/null +++ b/src/assets/conf/resources-landing-page.json @@ -0,0 +1,22 @@ +{ + "grid-container": [ + { + "title": "Paycor", + "description": "Clock in and out, request time off, review health benefits and access paystubs using the Paycor human-resources application.", + "imagePath": "PaycorLogo2-Circle_100x100.png", + "urlText": "https://www.paycor.com/" + }, + { + "title": "Gmail", + "description": "Access your company e-mail and a suite of Google apps, including a calendar, instant messaging and cloud storage.", + "imagePath": "GmailCircle_100x100.png", + "urlText": "https://mail.google.com" + }, + { + "title": "Workplace", + "description": "Get the latest news and connect with colleagues. JDSfaulkner uses Workplace by Facebook for posting and sharing.", + "imagePath": "WorkplaceLogo-Circle_100x100.png", + "urlText": "https://jdsfaulkner.workplace.com" + } + ] +} \ No newline at end of file diff --git a/src/assets/pages/resources-landing-page.html b/src/assets/pages/resources-landing-page.html index 8135228..baa94cb 100644 --- a/src/assets/pages/resources-landing-page.html +++ b/src/assets/pages/resources-landing-page.html @@ -5,7 +5,7 @@ ResourceFinder - + @@ -54,7 +54,7 @@
- +
diff --git a/src/assets/pages/scripts/index_app.js b/src/assets/pages/scripts/index_app.js index 3498dcb..2060104 100644 --- a/src/assets/pages/scripts/index_app.js +++ b/src/assets/pages/scripts/index_app.js @@ -2,9 +2,7 @@ const path = require('path'); const factory = require(path.join(appDir, 'viewFactory')) function loadDocuments() { - let container = document.querySelector("#grid-container"); - - factory.buildWebCard("https://www.paycor.com/", container, true); + factory.buildWebCardsFromConfig("resources-landing-page.json"); } loadDocuments(); \ No newline at end of file diff --git a/src/assets/pages/styles/ResourcesLandingPage.css b/src/assets/pages/styles/resources-landing-page.scss similarity index 99% rename from src/assets/pages/styles/ResourcesLandingPage.css rename to src/assets/pages/styles/resources-landing-page.scss index c45addf..6740037 100644 --- a/src/assets/pages/styles/ResourcesLandingPage.css +++ b/src/assets/pages/styles/resources-landing-page.scss @@ -38,3 +38,4 @@ .footer p { margin-bottom: .25rem; } + diff --git a/src/assets/pages/styles/theme-base.scss b/src/assets/pages/styles/theme-base.scss index 96c66e6..910eaf4 100644 --- a/src/assets/pages/styles/theme-base.scss +++ b/src/assets/pages/styles/theme-base.scss @@ -1,6 +1,21 @@ +@use "sass:map"; $enable-rounded: true !default; + @import "node_modules/bootstrap/scss/bootstrap"; @import "node_modules/bootstrap/scss/functions"; @import "node_modules/bootstrap/scss/variables"; -@import "node_modules/bootstrap/scss/mixins"; \ No newline at end of file +@import "node_modules/bootstrap/scss/mixins"; + +.web-card { + cursor: pointer; +} + +.web-card-background{ + background-color: map-get($theme-colors, secondary); +} + +.web-card-background:hover{ + background-color: map-get($theme-colors, warning); +} + diff --git a/src/assets/pages/styles/theme-dark.scss b/src/assets/pages/styles/theme-dark.scss index 91fe189..852c272 100644 --- a/src/assets/pages/styles/theme-dark.scss +++ b/src/assets/pages/styles/theme-dark.scss @@ -1,3 +1,4 @@ + $theme-colors: ( "primary": #0B031C, "secondary": #211F37, @@ -5,4 +6,5 @@ $theme-colors: ( "info": #1C1CDE, "warning": #303033 ); + @import "theme-base"; \ No newline at end of file diff --git a/src/assets/pages/styles/theme-light.scss b/src/assets/pages/styles/theme-light.scss index 19be165..44285e5 100644 --- a/src/assets/pages/styles/theme-light.scss +++ b/src/assets/pages/styles/theme-light.scss @@ -1,3 +1,4 @@ + $theme-colors: ( "primary": #ffffff, "secondary": #bbbbbb, diff --git a/src/assets/views/web-card.mustache b/src/assets/views/web-card.mustache index 2f3f5a8..51c1b2c 100644 --- a/src/assets/views/web-card.mustache +++ b/src/assets/views/web-card.mustache @@ -1,6 +1,6 @@ -
-
+
+
{{title}}

{{description}}

diff --git a/src/ts_source/templates.ts b/src/ts_source/templates.ts index 701d702..b1134a4 100644 --- a/src/ts_source/templates.ts +++ b/src/ts_source/templates.ts @@ -33,7 +33,6 @@ export function loadTemplate(filename: string, objs: object[], cb: TemplateCallb } export function loadTemplateSingle(filename: string, cardModel: CardModel, cb: (content: string, id: string) => void) { - console.log(cardModel); let contents = templateCache[filename]; if (!contents) throw new Error("No such template: " + filename); cardModel['id'] = createId(cardModel.resourcePath); diff --git a/src/ts_source/themes.ts b/src/ts_source/themes.ts index 97c4750..abd849d 100644 --- a/src/ts_source/themes.ts +++ b/src/ts_source/themes.ts @@ -36,11 +36,10 @@ export module Themes { for (let i = 0, l = headLinks.length; i < l; i++) { let link = headLinks[i]; if (themePattern.test(link.href)) { - console.log(`Found ${link}. Removing...`); - link.remove() + link.remove(); } } - head.append(buildCSSLink(newResource)); + head.prepend(buildCSSLink(newResource)); } function getButtonClassFromAppTheme(t: AppTheme): string { diff --git a/src/ts_source/viewFactory.ts b/src/ts_source/viewFactory.ts index 1b70d8c..b897cf4 100644 --- a/src/ts_source/viewFactory.ts +++ b/src/ts_source/viewFactory.ts @@ -1,4 +1,4 @@ -import {ConfigPaths, Configurator, FileUtils} from './fileutils' +import {Configurator, FileUtils} from './fileutils' import {loadTemplateSingle} from "./templates" const shell = require('electron').shell; @@ -37,36 +37,43 @@ export function buildFileCard(filePath: string, elem: Element, append: boolean = // }); } -export function buildDefaultWebCards(elem: Element) { - let userPrefs = Configurator.loadAppConfig(ConfigPaths.ApplicationConfigName); - let links = userPrefs['default-links']; +export function buildWebCardsFromConfig(configName: string) { + let elementConfig = Configurator.loadAppConfig(configName); let $ = require('jquery') - for (let i = 0, l = links.length; i < l; i++) { - let link = links[i]; - buildWebCard(link, elem, true, $); + let keys = Object.keys(elementConfig); + + + for (let i = 0, l = keys.length; i < l; i++) { + let key = keys[i]; + let contentList = elementConfig[key]; + let element = $(`#${key}`); + console.log(element); + for (let j = 0, m = contentList.length; j, obj, append: boolean = false, $: any = require('jquery')) { let model = new CardModel( - "Paycor", - "Clock in and out, request time off, review health benefits and access paystubs using the Paycor human-resources application.", - FileUtils.getPathToImage("PaycorLogo2-Circle_100x100.png"), - urlText + obj["title"], + obj["description"], + FileUtils.getPathToImage(obj["imagePath"]), + obj["urlText"] ); loadTemplateSingle("web-card.mustache", model, (content: string, id: string) => { - console.log(content); + console.log(elem); if (append) { - elem.innerHTML = elem.innerHTML + content; + elem.append(content); } else { - elem.innerHTML = content; + elem.html(content) } $(`#${id}`).on("click", () => { - launchWebsite(url.toString()); + launchWebsite(obj["urlText"].toString()); }); });