Skip to content

Commit 30be02b

Browse files
committed
Chart tooltips, scroll gutter fix, removed residues
Signed-off-by: Omkar Phansopkar <[email protected]>
1 parent 0a6c21e commit 30be02b

21 files changed

+123
-84
lines changed

src/app.css

+7-3
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,28 @@ body {
4141

4242

4343
/* Pie chart pages */
44+
.pieInfoDash {
45+
padding: 5px;
46+
padding-right: 18px;
47+
}
4448
.card {
4549
border-radius: 2px;
4650
box-shadow: 1px 0 8px -3px #b1b1b1;
4751
background-color: #FFFFFF;
4852
margin-bottom: 30px;
4953
}
5054

51-
.card .content {
55+
.card > .content {
5256
text-align: center;
5357
padding: 15px 15px 0;
5458
}
5559

56-
.card .header {
60+
.card > .header {
5761
text-align: center;
5862
padding: 15px 15px;
5963
}
6064

61-
.card .value {
65+
.card > .value {
6266
margin: 0;
6367
margin-left: auto;
6468
margin-right: auto;

src/components/Layout/Layout.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ const Layout = (props: React.PropsWithChildren) => {
2929
<Allotment className='pane-container'>
3030
<Allotment.Pane
3131
visible={showFileTree && initialized}
32-
minSize={120}
33-
maxSize={400}
34-
className="file-tree-pane overflow-scroll"
32+
minSize={10}
33+
maxSize={600}
34+
className="file-tree-pane"
3535
preferredSize="20%"
3636
>
3737
<FileTree style={{ minHeight: "100vh" }} />
3838
</Allotment.Pane>
39-
<Allotment.Pane className='overflow-scroll content-pane'>
39+
<Allotment.Pane className='content-pane'>
4040
<div className='content-container'>
4141
{ isImportFallbackRoute && !initialized ?<ImportFallback /> : props.children }
4242
</div>

src/components/Layout/layout.css

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@
1010
.file-tree-pane {
1111
border: 0;
1212
box-shadow: rgb(177 177 177) 1px 0px 18px -3px;
13+
overflow: overlay !important;
14+
}
15+
.content-pane {
16+
overflow: overlay !important;
1317
}
14-
1518
.content-container {
1619
padding: 10px;
1720
padding-top: 5px;

src/components/PieChart/PieChart.tsx

+15-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import c3 from 'c3';
2-
import React, { useEffect, useRef } from 'react'
2+
import React, { useEffect, useRef } from 'react';
33

44
import { FormattedEntry } from '../../utils/pie';
55
import { LEGEND_COLORS } from '../../constants/colors';
66

7+
import './piechart.css';
8+
79
interface ChartProps {
810
chartData: FormattedEntry[] | null,
911
}
1012

1113
const PieChart = (props: ChartProps) => {
12-
1314
const { chartData } = props;
1415
const chartRef = useRef<HTMLDivElement | null>(null);
1516

@@ -28,10 +29,19 @@ const PieChart = (props: ChartProps) => {
2829
}
2930
});
3031
}, [chartData]);
32+
33+
// useEffect(() => {
34+
// const intervalID = setInterval(() => {
35+
// console.log("Resizing pie chart as per dom");
36+
// if(c3Chart)
37+
// c3Chart.resize();
38+
// }, 1000);
39+
// () => {
40+
// clearInterval(intervalID);
41+
// }
42+
// }, [c3Chart]);
3143

32-
return (
33-
<div ref={chartRef} />
34-
)
44+
return <div ref={chartRef} />
3545
}
3646

3747
export default PieChart

src/components/PieChart/piechart.css

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
.c3-tooltip-container {
2+
z-index: 10
3+
}
4+
5+
.c3-tooltip {
6+
border-collapse: collapse;
7+
border-spacing: 0;
8+
background-color: #fff;
9+
empty-cells: show;
10+
-webkit-box-shadow: 7px 7px 12px -9px #777;
11+
-moz-box-shadow: 7px 7px 12px -9px #777;
12+
box-shadow: 7px 7px 12px -9px #777;
13+
}
14+
15+
.c3-tooltip tr {
16+
border: 1px solid rgb(255, 255, 255)
17+
}
18+
19+
.c3-tooltip th {
20+
background-color: rgb(255, 255, 255);
21+
font-size: 14px;
22+
padding: 2px 5px;
23+
text-align: left;
24+
color: #fff
25+
}
26+
27+
.c3-tooltip td {
28+
font-size: 13px;
29+
padding: 3px 6px;
30+
background-color: #fff;
31+
border-left: 1px dotted #999
32+
}
33+
34+
.c3-tooltip td>span {
35+
display: inline-block;
36+
width: 10px;
37+
height: 10px;
38+
margin-right: 6px
39+
}
40+
41+
.c3-tooltip td.value {
42+
text-align: right
43+
}

src/lib/css/fonts/Lato-Bold.ttf

-119 KB
Binary file not shown.

src/lib/css/fonts/Lato-Italic.ttf

-116 KB
Binary file not shown.

src/lib/css/fonts/Lato-Light.ttf

-120 KB
Binary file not shown.

src/lib/css/fonts/Raleway-Light.ttf

-129 KB
Binary file not shown.

src/lib/css/fonts/Raleway-Medium.ttf

-126 KB
Binary file not shown.
-128 KB
Binary file not shown.
-69.1 KB
Binary file not shown.

src/lib/css/fonts/fontawesome-webfont.woff2.ABOUT

-13
This file was deleted.

src/lib/css/fonts/fontawesome-webfont.woff2.LICENSE

-8
This file was deleted.

src/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import isDev from 'electron-is-dev';
2-
import { app, BrowserWindow, Menu, shell } from 'electron';
2+
import { app, BrowserWindow, ipcMain, Menu, shell } from 'electron';
33

44
import getTemplate from './mainMenu';
55
import { setUpIpcListeners } from './mainActions';
@@ -63,7 +63,7 @@ const createWindow = (): void => {
6363
shell.openExternal(url);
6464
});
6565
}
66-
66+
ipcMain.removeAllListeners();
6767
setUpIpcListeners(mainWindow);
6868
};
6969

src/mainMenu.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { GENERAL_ACTIONS, NAVIGATION_CHANNEL } from './constants/IpcConnection';
22
import packageJson from '../package.json';
33
import { app, BrowserWindow, MenuItem, shell } from 'electron';
4-
import { importJsonFile, openSqliteFile, saveSqliteFile, showErrorDialog } from './mainActions';
4+
import { importJsonFile, openSqliteFile, saveSqliteFile } from './mainActions';
55
import { ROUTES } from './constants/routes';
66

77
/** Returns a 'lambda' that sends the event to the renderer process. */

src/pages/FileInfoDash/FileInfoDash.tsx

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Op } from 'sequelize';
2-
import { Row, Col } from 'react-bootstrap';
2+
import { Row, Col, Card } from 'react-bootstrap';
33
import React, { useEffect, useState } from 'react'
44

55
import { formatChartData } from '../../utils/pie';
@@ -39,9 +39,9 @@ const FileInfoDash = () => {
3939
.then(root => {
4040
// Prepare aggregate data
4141
const filesCount =
42-
root.getDataValue('type').toString({}) === 'directory' ? root.getDataValue('files_count') : 1;
42+
root.getDataValue('type').toString({}) === 'directory' ? root.getDataValue('files_count') || 0 : 1;
4343
const dirsCount =
44-
root.getDataValue('type').toString({}) === 'directory' ? root.getDataValue('dirs_count') : 0;
44+
root.getDataValue('type').toString({}) === 'directory' ? root.getDataValue('dirs_count') || 0 : 0;
4545

4646
setScanData(oldScanData => ({
4747
...oldScanData,
@@ -102,15 +102,15 @@ const FileInfoDash = () => {
102102
}, [workbenchDB]);
103103

104104
return (
105-
<div className='text-center'>
105+
<div className='text-center pieInfoDash'>
106106
<br/>
107107
<h3>
108108
File info - { workbenchDB.currentPath || ""}
109109
</h3>
110110
<br/><br/>
111111
<Row className="dash-cards">
112112
<Col sm={4}>
113-
<div className='card info-card'>
113+
<Card className='info-card'>
114114
{
115115
scanData.totalFiles === null ?
116116
<EllipticLoader />
@@ -122,10 +122,10 @@ const FileInfoDash = () => {
122122
<h5 className='title'>
123123
Total Number of Files
124124
</h5>
125-
</div>
125+
</Card>
126126
</Col>
127127
<Col sm={4}>
128-
<div className='card info-card'>
128+
<Card className='info-card'>
129129
{
130130
scanData.totalDirectories === null ?
131131
<EllipticLoader />
@@ -137,10 +137,10 @@ const FileInfoDash = () => {
137137
<h5 className='title'>
138138
Total Number of Directories
139139
</h5>
140-
</div>
140+
</Card>
141141
</Col>
142142
<Col sm={6} md={4}>
143-
<div className='card info-card'>
143+
<Card className='info-card'>
144144
{
145145
scanData.totalUniqueCopyrightHolders === null ?
146146
<EllipticLoader />
@@ -152,34 +152,34 @@ const FileInfoDash = () => {
152152
<h5 className='title'>
153153
Unique Copyright Holders Detected
154154
</h5>
155-
</div>
155+
</Card>
156156
</Col>
157157
</Row>
158158
<br/><br/>
159159
<Row className="dash-cards">
160160
<Col sm={6} md={4}>
161-
<div className='card chart-card'>
161+
<Card className='chart-card'>
162162
<h5 className='title'>
163163
Programming languages
164164
</h5>
165165
<PieChart chartData={progLangsData} />
166-
</div>
166+
</Card>
167167
</Col>
168168
<Col sm={6} md={4}>
169-
<div className='card chart-card'>
169+
<Card className='chart-card'>
170170
<h5 className='title'>
171171
File types
172172
</h5>
173173
<PieChart chartData={fileTypesData} />
174-
</div>
174+
</Card>
175175
</Col>
176176
<Col sm={6} md={4}>
177-
<div className='card chart-card'>
177+
<Card className='chart-card'>
178178
<h5 className='title'>
179179
Copyright holders
180180
</h5>
181181
<PieChart chartData={copyrightHoldersData} />
182-
</div>
182+
</Card>
183183
</Col>
184184
</Row>
185185
<br/><br/>

0 commit comments

Comments
 (0)