diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..3cdc6ae
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..4daf1b2
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/dbnavigator.xml b/.idea/dbnavigator.xml
new file mode 100644
index 0000000..61c67dd
--- /dev/null
+++ b/.idea/dbnavigator.xml
@@ -0,0 +1,458 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/copy.sh b/copy.sh
index 333a0dd..c2e9680 100755
--- a/copy.sh
+++ b/copy.sh
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
# rm -rf /home/martin/dev/menuserver/dist/*
-cp -r /home/martin/dev/svelte-jobs/public/* /home/martin/dev/jobscraper/dist
+cp -r /home/martin/dev/svelte-jobs/public/* /home/martin/dev/jobscraper/server/dist
diff --git a/package-lock.json b/package-lock.json
index 6ed8ce7..acb8c18 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -58,6 +58,14 @@
}
}
},
+ "@rollup/plugin-json": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.0.3.tgz",
+ "integrity": "sha512-QMUT0HZNf4CX17LMdwaslzlYHUKTYGuuk34yYIgZrNdu+pMEfqMS55gck7HEeHBKXHM4cz5Dg1OVwythDdbbuQ==",
+ "requires": {
+ "@rollup/pluginutils": "^3.0.8"
+ }
+ },
"@rollup/plugin-node-resolve": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-7.1.3.tgz",
@@ -75,7 +83,6 @@
"version": "3.0.10",
"resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.0.10.tgz",
"integrity": "sha512-d44M7t+PjmMrASHbhgpSbVgtL6EFyX7J4mYxwQ/c5eoaE6N2VgCgEcWVzNnwycIloti+/MpwFr8qfw+nRw00sw==",
- "dev": true,
"requires": {
"@types/estree": "0.0.39",
"estree-walker": "^1.0.1",
@@ -85,8 +92,7 @@
"estree-walker": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz",
- "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==",
- "dev": true
+ "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg=="
}
}
},
@@ -99,8 +105,7 @@
"@types/estree": {
"version": "0.0.39",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz",
- "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==",
- "dev": true
+ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw=="
},
"@types/node": {
"version": "14.0.1",
@@ -791,6 +796,14 @@
"sha.js": "^2.4.8"
}
},
+ "cron": {
+ "version": "1.8.2",
+ "resolved": "https://registry.npmjs.org/cron/-/cron-1.8.2.tgz",
+ "integrity": "sha512-Gk2c4y6xKEO8FSAUTklqtfSr7oTq0CiPQeLBG5Fl0qoXpZyMcj1SG59YL+hqq04bu6/IuEA7lMkYDAplQNKkyg==",
+ "requires": {
+ "moment-timezone": "^0.5.x"
+ }
+ },
"cross-spawn": {
"version": "6.0.5",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
@@ -2305,6 +2318,19 @@
"minimist": "^1.2.5"
}
},
+ "moment": {
+ "version": "2.25.3",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.25.3.tgz",
+ "integrity": "sha512-PuYv0PHxZvzc15Sp8ybUCoQ+xpyPWvjOuK72a5ovzp2LI32rJXOiIfyoFoYvG3s6EwwrdkMyWuRiEHSZRLJNdg=="
+ },
+ "moment-timezone": {
+ "version": "0.5.31",
+ "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.31.tgz",
+ "integrity": "sha512-+GgHNg8xRhMXfEbv81iDtrVeTcWt0kWmTEY1XQK14dICTXnWJnT0dxdlPspwqF3keKMVPXwayEsk1DI0AA/jdA==",
+ "requires": {
+ "moment": ">= 2.9.0"
+ }
+ },
"mri": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/mri/-/mri-1.1.5.tgz",
@@ -2313,8 +2339,7 @@
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
- "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "dev": true
+ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"mute-stream": {
"version": "0.0.8",
@@ -2688,8 +2713,7 @@
"picomatch": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz",
- "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==",
- "dev": true
+ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg=="
},
"pify": {
"version": "2.3.0",
diff --git a/package.json b/package.json
index df9954b..ca1faa2 100644
--- a/package.json
+++ b/package.json
@@ -21,7 +21,10 @@
"svelte-preprocess": "^3.7.1"
},
"dependencies": {
+ "@rollup/plugin-json": "^4.0.3",
"autoprefixer": "^9.7.6",
+ "cron": "^1.8.2",
+ "ms": "^2.1.2",
"node-sass": "^4.14.1",
"redaxios": "^0.2.0",
"rollup-plugin-replace": "^2.2.0",
diff --git a/public/gfx/star.svg b/public/gfx/star.svg
new file mode 100644
index 0000000..66c36c2
--- /dev/null
+++ b/public/gfx/star.svg
@@ -0,0 +1,25 @@
+
+
diff --git a/public/index.html b/public/index.html
index 5da7ed3..e744409 100644
--- a/public/index.html
+++ b/public/index.html
@@ -4,7 +4,7 @@
-
Svelte app
+ Jobs Server
diff --git a/rollup.config.js b/rollup.config.js
index b3b9379..127b769 100644
--- a/rollup.config.js
+++ b/rollup.config.js
@@ -7,6 +7,7 @@ import { terser } from 'rollup-plugin-terser';
import sveltePreprocess from 'svelte-preprocess';
import builtins from 'rollup-plugin-node-builtins';
import globals from 'rollup-plugin-node-globals';
+import json from '@rollup/plugin-json';
const production = !process.env.ROLLUP_WATCH;
@@ -30,6 +31,7 @@ export default {
'plugins': [
globals(),
builtins(),
+ json(),
svelte({
// enable run-time checks when not in production
'dev': !production,
diff --git a/src/App.svelte b/src/App.svelte
index 4e657e2..a7caf73 100644
--- a/src/App.svelte
+++ b/src/App.svelte
@@ -2,6 +2,7 @@
import Menu from "./components/Menu.svelte";
import Lister from "./components/Lister.svelte";
import Detail from "./components/Detail.svelte";
+ import Header from "./components/Header.svelte";
-
-
-
-
-
+
+
diff --git a/src/components/Detail.svelte b/src/components/Detail.svelte
index e1db1e6..c6134dc 100644
--- a/src/components/Detail.svelte
+++ b/src/components/Detail.svelte
@@ -4,18 +4,52 @@
let jobDetail = {};
let visible = false;
+ let applied = false;
+ let jobtype = 0;
+
+ $: {
+ if (!isEmpty($JobDetails)) {
+ applied = typeof ($JobDetails.data.applied) === "number" && $JobDetails.data.applied === 1;
+ jobtype = $JobDetails.data.jobtype;
+ }
+ }
JobDetails.subscribe((v) => {
visible = !isEmpty(v);
+ console.log(v);
+
})
function isEmpty(obj) {
- for(const key in obj)
- if(obj.hasOwnProperty(key)) return false;
+ for (const key in obj)
+ if (obj.hasOwnProperty(key)) return false;
return true;
}
+
+ function handleClick() {
+ actions.appliedJob($JobDetails._id);
+ }
+
+ function kill(w) {
+ console.log('>>kill',w);
+ }
+
+ function upvote() {
+
+ console.log('Upvote', $JobDetails._id);
+
+ actions.upVote($JobDetails._id);
+ }
+
+ function downvote() {
+ console.log('Downvote', $JobDetails._id);
+
+ actions.downVote($JobDetails._id);
+ }
+
+
{#if visible}
-
-
-
-
- {$JobDetails.title}
+
+
+
+
+ {$JobDetails.title}
+
+
+
+ {#if jobtype === 1}
+
Contract
+ {:else if jobtype === 2}
+
Permanent
+ {/if}
+
+
+
+ Company: {$JobDetails.company}
+
+
+ Location: {$JobDetails.location}
+
+
+ Applied:
+ {#if !$JobDetails.a}
+
+ {:else}
+ Applied!
+ {/if}
+
+
+
+
+
+
+
+ Salary: {$JobDetails.salary}
+
+
+ Scraped: {$JobDetails.date}
+
+
+
+
+
+
+
+ {#each $JobDetails.data.autoclass.words as word, _wid}
+ {#if $JobDetails.data.autoclass.good.indexOf(word) !== -1}
+ {word}
+ {:else if $JobDetails.data.autoclass.bad.indexOf(word) !== -1}
+ {word}
+ {:else }
+ {word}
+ {/if}
+ {/each}
+
+
+
+
+
+
+
+
+
+
+
-
-
- Company: {$JobDetails.company}
-
-
- Location: {$JobDetails.location}
-
-
-
-
-
- Salary: {$JobDetails.salary}
-
-
- Scraped: {$JobDetails.date}
-
-
-
-
-
-
+
+ {@html $JobDetails.summary}
+
-
- {$JobDetails.summary}
-
-
{/if}
diff --git a/src/components/Header.svelte b/src/components/Header.svelte
new file mode 100644
index 0000000..d83647b
--- /dev/null
+++ b/src/components/Header.svelte
@@ -0,0 +1,34 @@
+
+
+
+
+
diff --git a/src/components/Lister.svelte b/src/components/Lister.svelte
index be4cfa6..14b31d1 100644
--- a/src/components/Lister.svelte
+++ b/src/components/Lister.svelte
@@ -2,9 +2,32 @@
import {JobList, actions} from '../state/state';
+ let prevRow;
+
const handleClick = id => {
actions.loadJobDetail(id);
};
+
+ function clickEvent(event) {
+ const parent = event.target.parentElement;
+ const id = parent.dataset.id;
+ actions.loadJobDetail(id);
+ actions.touchJob(id);
+ }
+
+ function ellipses(instr) {
+ return (instr.length <= 40) ? instr : `${instr.slice(0, 40)}…`
+
+ }
+
+ function haveRead(inval) {
+ return (inval.read !== 0) ? 'read' : '';
+ }
+
+ function haveApplied(inval) {
+ return (inval.applied !== 0) ? 'applied' : '';
+ }
+
@@ -40,10 +99,22 @@
{#each $JobList as item, _id}
-
- {item.title} |
+
+
+
+ {item.title}
+
+ |
{item.site} |
- {item.company} |
+ {ellipses(item.company)} |
{item.date} |
{/each}
diff --git a/src/components/Menu.svelte b/src/components/Menu.svelte
index 7267b2e..379f411 100644
--- a/src/components/Menu.svelte
+++ b/src/components/Menu.svelte
@@ -1,23 +1,27 @@
-