Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
cleanup gui, webpack, components
Browse files Browse the repository at this point in the history
  • Loading branch information
vlrmprjct committed Nov 28, 2021
1 parent 58dcf7e commit fd509e9
Show file tree
Hide file tree
Showing 21 changed files with 236 additions and 185 deletions.
6 changes: 2 additions & 4 deletions config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ const DotenvFlow = require('dotenv-flow-webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

const StylishReporter = require('webpack-stylish');

const buildDir = '../dist';

module.exports = env => {
Expand Down Expand Up @@ -37,7 +35,7 @@ module.exports = env => {
mode: (env.production) ? 'production' : 'development',
devtool: (env.production) ? 'none' : 'inline-source-map',
entry: ['babel-polyfill', './src/client/index.js'],
stats: 'none',
stats: 'minimal',
module: {
rules: [
{
Expand Down Expand Up @@ -106,7 +104,7 @@ module.exports = env => {
template: './public/index.html',
favicon: './public/favicon.svg'
}),
new StylishReporter(),
// new StylishReporter(),
],
output: {
publicPath: '/',
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
"dependencies": {
"@csstools/normalize.css": "^12.0.0",
"babel-polyfill": "^6.26.0",
"concurrently": "^6.4.0",
"cuid": "^2.1.8",
"date-and-time": "^2.0.1",
"express": "^4.17.1",
Expand All @@ -32,8 +31,7 @@
"react-router-dom": "^5.1.2",
"react-splitter-layout": "^4.0.0",
"react-table": "^7.0.0",
"uikit": "3.6.0",
"webpack-stylish": "^0.1.8"
"uikit": "3.6.0"
},
"devDependencies": {
"@babel/core": "^7.16.0",
Expand All @@ -43,6 +41,7 @@
"@svgr/webpack": "^5.5.0",
"babel-eslint": "^10.0.0",
"babel-loader": "^8.2.3",
"concurrently": "^6.4.0",
"css-loader": "^5.2.7",
"dotenv": "^10.0.0",
"dotenv-flow": "^3.2.0",
Expand Down
4 changes: 4 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<meta name="description" content="PIA, Electronics Parts/component Inventory Application called PIA">
<link rel="manifest" href="/manifest.json">
<title>PIA</title>

<script type="module" src="/pwabuilder-sw-register.js"></script>
</head>

<body>
Expand Down
24 changes: 24 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"background_color": "#16161C",
"description": "Electronics Parts/component Inventory Application called PIA",
"dir": "ltr",
"display": "standalone",
"name": "pia-evo.vercel",
"orientation": "any",
"scope": "/",
"short_name": "PIA",
"start_url": "/",
"theme_color": "#21BFC2",
"categories": [],
"screenshots": [],
"icons": [
{
"src": "/favicon.svg"
},
{
"src": "/favicon.ico",
"type": "image/x-icon"
}
],
"shortcuts": []
}
4 changes: 4 additions & 0 deletions public/pwabuilder-sw-register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import 'https://cdn.jsdelivr.net/npm/@pwabuilder/pwaupdate';

const el = document.createElement('pwa-update');
document.body.appendChild(el);
25 changes: 25 additions & 0 deletions public/pwabuilder-sw.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* eslint-disable no-undef */
const CACHE = "pwabuilder-offline";
const QUEUE_NAME = "bgSyncQueue";

importScripts('https://storage.googleapis.com/workbox-cdn/releases/5.1.2/workbox-sw.js');

self.addEventListener("message", (event) => {
if (event.data && event.data.type === "SKIP_WAITING") {
self.skipWaiting();
}
});

const bgSyncPlugin = new workbox.backgroundSync.BackgroundSyncPlugin(QUEUE_NAME, {
maxRetentionTime: 24 * 60 // Retry for max of 24 Hours (specified in minutes)
});

workbox.routing.registerRoute(
new RegExp('/*'),
new workbox.strategies.StaleWhileRevalidate({
cacheName: CACHE,
plugins: [
bgSyncPlugin
]
})
);
18 changes: 0 additions & 18 deletions src/client/scss/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -237,21 +237,3 @@ main {
height: 2rem;
}
}


.sort {
position: absolute;
right: 1px;
top: 4px;

&-icon {
display: block;
height: 0.8rem;
color: $global-color-disabled;

&--active {
color: $global-link-color;
}
}

}
10 changes: 10 additions & 0 deletions src/client/scss/form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ $itemAttributes: (
@each $itemAttribute in $itemAttributes {
[for='#{$itemAttribute}'] {
grid-area: unquote($itemAttribute);

> button,
> a {
top: 1.8rem;

:hover {
color: $global-link-color;
}
}

}
}
}
1 change: 1 addition & 0 deletions src/client/scss/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@
@import 'form';
@import 'spin';
@import 'login';
@import 'table';
11 changes: 10 additions & 1 deletion src/client/scss/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@
border-style: solid;
}

@mixin hook-button-default-hover() {
color: $inverse-global-color;
}
@mixin hook-button-default-active() {
color: $inverse-global-color;
}

@mixin hook-button() {
border-radius: $base-pre-border-radius;
line-height: 2.75rem;
Expand Down Expand Up @@ -93,7 +100,7 @@
@mixin hook-form-label() {
text-transform: uppercase;
font-size: 11px;
font-weight: bold;
font-weight: normal;
line-height: 2rem;
}

Expand All @@ -108,8 +115,10 @@
}

@mixin hook-table-header-cell() {
font-weight: normal;
position: relative;
text-overflow: ellipsis;
text-transform: uppercase;
overflow: hidden;
}

Expand Down
23 changes: 23 additions & 0 deletions src/client/scss/table.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
th,
td {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.sort {
position: absolute;
right: 1px;
top: 4px;

&-icon {
display: block;
height: 0.8rem;
color: $global-color-disabled;

&--active {
color: $global-link-color;
}
}

}
45 changes: 0 additions & 45 deletions src/client/utils/filter.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,4 @@
import React, { useEffect} from 'react';
import { matchSorter } from 'match-sorter';
import { useFocus } from './usefocus';

export const GlobalFilter = ({
preGlobalFilteredRows,
globalFilter,
setGlobalFilter,
}) => {
const [inputRef, setInputFocus] = useFocus();
const count = preGlobalFilteredRows.length;

useEffect(() => {
setInputFocus();
}, []);

return (
<input
ref={inputRef}
className="filter uk-input"
type="text"
value={globalFilter || ''}
onChange={e => {
setGlobalFilter(e.target.value || undefined);
}}
placeholder={`Search in ${count} records ...`}
/>
);
};

export const DefaultColumnFilter = ({
column: { filterValue, preFilteredRows, setFilter },
}) => {
const count = preFilteredRows.length;

return (
<input
ref
value={filterValue || ''}
onChange={e => {
setFilter(e.target.value || undefined);
}}
placeholder={`Search ${count} records...`}
/>
);
};

export const fuzzyTextFilter = (rows, id, filterValue) => {
return matchSorter(rows, filterValue, { keys: [row => row.values[id]] });
Expand Down
7 changes: 7 additions & 0 deletions src/client/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
export * from './api';
export * from './filter';
export * from './localstorage';
export * from './notification';
export * from './prepareForm';
export * from './scrollbar';
export * from './sleep';
export * from './stringcolor';
export * from './usefocus';
export * from './validjson';
33 changes: 0 additions & 33 deletions src/client/utils/theme.js

This file was deleted.

5 changes: 4 additions & 1 deletion src/client/views/App/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import React from 'react';

const Footer = () => (
<footer>
<a href="https://github.com/vlrmprjct/pia">©2021</a>
<a href="https://github.com/vlrmprjct/pia" rel="noreferrer" target="_blank">
<span aria-label="copyright" role="img">©️</span>
{new Date().getFullYear()}
</a>
</footer>
);

Expand Down
Loading

0 comments on commit fd509e9

Please sign in to comment.