From c4d327d3858c084406fc103d27f0976cb223b839 Mon Sep 17 00:00:00 2001 From: Ayush Mukherjee Date: Tue, 15 Oct 2019 16:04:45 +0530 Subject: [PATCH] finished mvp --- html/css/main.css | 82 +++++++++++++++++++++++++++++++++++++++++++++++ html/index.html | 55 ++++++++++++++++++++++++++++--- index.js | 62 +++++++++++------------------------ 3 files changed, 151 insertions(+), 48 deletions(-) create mode 100644 html/css/main.css diff --git a/html/css/main.css b/html/css/main.css new file mode 100644 index 0000000..14cb8fb --- /dev/null +++ b/html/css/main.css @@ -0,0 +1,82 @@ +html, +body { + margin: 0; + padding: 0; + box-sizing: border-box; + color: #292929; + /* max-width: 99vw; */ +} + +*, +*::before, +*::after { + box-sizing: inherit; +} + +header { + height: 80px; + display: flex; + justify-content: center; + align-content: center; + box-shadow: 1px 3px 4px rgba(0, 0, 0, 0.05); +} + +header > h1 { + font-family: 'Montserrat', sans-serif; + letter-spacing: 0.3rem; + font-size: 2.2rem; +} + +.container { + display: grid; + grid-template-rows: 1fr; + /* grid-column-gap: 10px; */ + grid-template-columns: 300px 0px 1fr; + grid-template-areas: 'left gap right'; + height: 100%; + background: #eee; + min-height: 0; + min-width: 0; + overflow-wrap: break-word; +} + +.container > .left { + grid-area: left; + background: #999; + padding: 1.5em 1em; + overflow: hidden; + min-width: 0; +} + +.left > .user_email { + margin: 50px 0; +} + +.container > .right { + grid-area: right; + padding: 1.5em 1em; + overflow: hidden; + min-width: 0; +} + +.container > .right > #status { + width: 100%; + height: 300px; + overflow-y: scroll; + overflow-x: hidden; + overflow-wrap: break-word; + background: transparent; + border: 1px solid; + border-radius: 5px; +} + +.container > .right > #log { + width: 100%; + height: 300px; + overflow-y: scroll; + overflow-x: hidden; + overflow-wrap: break-word; + background: transparent; + border: 1px solid; + border-radius: 5px; +} \ No newline at end of file diff --git a/html/index.html b/html/index.html index ef6177e..c387766 100644 --- a/html/index.html +++ b/html/index.html @@ -1,10 +1,40 @@ CPGC + + - Hello, world! -

+
+

CPGC

+
+ +
+
+
+ User Name: + +
+ +
+ User Email: + +
+ +
+ Remote URL:
+ +
+
+
+ Current Branch: +
+ Git Status:
+ + Git Log:
+ +
+
diff --git a/index.js b/index.js index 9963da1..8b4a37c 100644 --- a/index.js +++ b/index.js @@ -5,49 +5,8 @@ const path = require('path'); const { app, BrowserWindow } = require('electron'); const ipc = require('electron').ipcMain; -const list_dir = () => { - if(platform == 'linux') { - return execSync("ls -lA | awk '{print $9}'") - .toString() - .split(EOL); - } - -} - -var origin; - -let user = execSync("git config --list").toString().split(EOL); -//console.log(user); - -const m = list_dir().forEach((l) => { - if(l == '.git') { - origin = fs.open(path.join(__dirname, '.git/config'), 'r', function(err, file) { - if(err) - console.log(err + '1'); - fs.readFile(file, function(err, data) { - if(err) - console.log(err); - let i = data.toString().indexOf('url') + 6; - let c = data.toString()[i]; - origin = c; - while(c != '\n') { - i++; - c = data.toString()[i]; - origin += c; - } - - return origin; - }); - }); - } -}); - -console.log(user[0]); - -let win; - function createWindow() { - win = new BrowserWindow({ + let win = new BrowserWindow({ width: 800, height: 600, webPreferences: { @@ -56,9 +15,24 @@ function createWindow() { }); win.loadFile('html/index.html'); - win.webContents.send('send_username', user[0]); - win.webContents.openDevTools() + // win.webContents.openDevTools() + win.webContents.on('did-finish-load', () => { + win.webContents.send('send_username', name); + win.webContents.send('send_useremail', email); + win.webContents.send('send_remote', remote); + win.webContents.send('send_status', status); + win.webContents.send('send_log', log); + win.webContents.send('send_branch', branch); + }); } app.on('ready', createWindow); +let user = execSync("git config --list").toString().split(EOL); +let email = user[0].split('=')[1]; +let name = user[1].split('=')[1]; +let remote = user[6].split('=')[1]; + +let status = execSync("git status").toString(); +let log = execSync("git log").toString(); +let branch = execSync("git branch | grep \* | cut -d ' ' -f2").toString(); \ No newline at end of file