Skip to content

UI Changes #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tinyphone-ui",
"version": "0.1.0",
"homepage" : "http://voiceip.github.io/tinyphone-ui",
"homepage": "http://voiceip.github.io/tinyphone-ui",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.28",
Expand Down
174 changes: 119 additions & 55 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,45 +1,88 @@
@import url(https://fonts.googleapis.com/css?family=Roboto:400,100);

/* Color Scheme */
:root {
--primary: #2196F3;
--primary-variant: #1976D2;
--secondary: #26A69A;
--background: #F0F2F5;
--surface: #FFFFFF;
--text-primary: #212121;
--text-secondary: #757575;
}

/* Global Styles */
body{
font-family: 'Roboto';
background-color: var(--background);
font-size: 16px;
line-height: 1.5;
color: var(--text-primary);
}

nav.navbar{
nav.navbar {
display: flex;
align-items: center;
min-height: 65px;
background-color: var(--primary);
color: var(--surface);
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
}

.alert-danger{
background-color: #F2DEDE; /* very pale pink */
color: #8A4A4A; /* muted red */
padding: 15px;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border: none;
}

.login-container{
margin-top: 100px;
display: flex;
justify-content: center;
}


.info-container{
margin:50px;
margin-top: 100px;
}

.login{
width: 400px;
padding: 40px;
background-color: #F7F7F7;
margin: 0 auto 10px;
border-radius: 2px;
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
overflow: hidden;
width: 400px;
padding: 40px;
background-color: var(--surface);
margin: 0 auto 10px;
border-radius: 8px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.name{
color: #fff;
color: var(--surface);
margin: 0 15px;
font-weight: bold;
}
Comment on lines +63 to 66
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Potential Contrast Issue with .name: The .name class is set to use color: var(--surface), which is the same value used as the background color for the .login container. This could lead to poor readability. Please confirm whether this was intentional or consider using a contrasting color (for example, var(--text-primary)).


.message{
margin-top: 10px;
}

.loading{
margin-right: 10px;
}

/*Form*/

input[type="text"], input[type="password"] {
border: 1px solid var(--text-secondary);
border-radius: 4px;
padding: 8px;
margin-bottom: 10px;
width: 100%;
}

/* Progress Bar */
/* Thanks to https://codepen.io/holdencreative/pen/vEVbwv */
.progress-loader {
Expand All @@ -50,11 +93,11 @@ nav.navbar{
background-color: #acece6;
background-clip: padding-box;
overflow: hidden; }
.progress-loader .determinate {
position: absolute;
background-color: inherit;
top: 0;
bottom: 0;
.progress-loader .determinate {
position: absolute;
background-color: inherit;
top: 0;
bottom: 0;
background-color: #26a69a;
transition: width .3s linear; }
.progress-loader .indeterminate {
Expand Down Expand Up @@ -127,87 +170,108 @@ nav.navbar{
.dialer {
margin: 20px auto 0;
width: 280px;
text-align: center;
box-shadow: 20px 20px 10px grey;
text-align: center;
background-color: var(--surface);
border-radius: 10px;
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

.StatusArea {
padding-top: 7px;
height: 120px;
width: 280px;
padding: 15px;
width: 100%;
Comment on lines 180 to +182
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix property override in StatusArea

There's a conflict between padding-top and padding properties which may lead to unexpected styling.

According to the static analysis hint, you should remove the redundant padding-top property:

.StatusArea {
-    padding-top: 7px;
    padding: 15px;
    width: 100%;
    /* rest of the properties */
}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
padding-top: 7px;
height: 120px;
width: 280px;
padding: 15px;
width: 100%;
.StatusArea {
padding: 15px;
width: 100%;
/* rest of the properties */
}
🧰 Tools
🪛 Biome (1.9.4)

[error] 172-172: Unexpected shorthand property padding after padding-top

(lint/suspicious/noShorthandPropertyOverrides)

text-align: center;
font-size: 16px;
background-color: #0470bf;
color: white;
background-color: var(--primary);
color: var(--surface);
font-weight: bold;
border-style: outset;
border-color: #599ef2;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}

.functionArea {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-auto-rows: minmax(2px, auto);
grid-auto-rows: minmax(60px, auto);
text-align: center;
background-color: #eaeaea;
}

.keypad {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-rows: minmax(80px, auto);
grid-auto-rows: minmax(70px, auto);
text-align: center;
background-color: #eaeaea;
gap: 5px; /* Keep horizontal gap at 5px */
row-gap: 3px; /* Reduce vertical gap to 3px */
}

.button {
margin: 18px auto 0;
border-radius: 4px;
margin: 10px auto;
border-radius: 8px;
width: 85%;
height: 70%;
padding: 8px;
background: #027cd5;
color: white;
border-color: #599ef2;
border-style: outset;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
background-color: #E3F2FD; /* Lighter blue */
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2); /* Subtle shadow */
color: var(--text-primary);
border: none;
font-weight: bold;
font-size: 18px;



cursor: pointer;
font-family: 'Roboto', serif;
}

.button:hover {
background: #166095;
background: var(--primary);

}

input[type="display"] {
height: 60px;
width: 280px;
text-align: center;
font-size: 22px;
background-color: #0470bf;
color: white;
font-weight: bold;
outline: none !important;
border-style: none;
height: 60px; /* Keep the fixed height */
width: 100%; /* Fill available width */
font-size: 22px; /* Keep the font size */
background-color: #E3F2FD; /* Keep the background color */
color: var(--text-primary); /* Keep the text color */
font-weight: bold; /* Keep the font weight */
white-space: nowrap; /* Prevent text from wrapping */
overflow-x: auto; /* Enable horizontal scrolling */
text-align: center; /* Align to center */
border: none;
outline: none;
}

.functionButton {
margin: 10px auto;
width: 60px;
height: 60px;
background-color: #eaeaea;
border-style: none;
outline: none !important;
}

.functionButton:hover {
opacity: 0.50;
}
width: 85%;
background-color: var(--surface); /* Match number button background */
border: none; /* Remove border */
border-radius: 8px; /* Match number button border-radius */
outline: none !important;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}

.functionButton:hover {
background-color: var(--primary);
}


.sub-dig {
font-size: 12px;
font-weight: 500;
position: relative;
top: -3px;

pointer-events: none;
margin-top: -3px;
}

.overflowing {
text-align: right;
}
42 changes: 37 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {Fragment, useEffect, useState, useCallback} from 'react';
import React, {Fragment, useEffect, useState, useCallback, useRef} from 'react';
import {shallowEqual, useDispatch, useSelector} from 'react-redux';
import Form from 'react-bootstrap/Form';
import Button from 'react-bootstrap/Button';
Expand All @@ -7,7 +7,7 @@ import Spinner from 'react-bootstrap/Spinner';
import {SlideDown} from 'react-slidedown'
import 'react-slidedown/lib/slidedown.css'
import {callStatus, dial, dtmf, getAccounts, getSoftphoneStatus, hangUp, hold, loginSync, logout, unHold, updateCallStatus} from './actions';
import {ToastContainer} from 'react-toastify';
import {ToastContainer, Bounce} from 'react-toastify';
import logo from './logo.png';
import {CALL_TERMINATE, CONFIRMED, DISCONNECTED, LOADER, EARLY, LOCAL_HOLD} from './constant';
import './App.css';
Expand Down Expand Up @@ -136,6 +136,8 @@ function WSEventStream() {
function Dialer() {
const dispatch = useDispatch();
const loading = useSelector(state => state.loading, shallowEqual);
const inputRef = useRef(null);

Comment on lines +139 to +140
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Input reference created but not attached to any element

The inputRef is created but never attached to an input element. This will cause the useEffect hook that uses this reference to not work as expected.

You need to attach the ref to the input element on line 280:

-<SlideDown><form><input type="display" value={phoneNumber} onChange={(ev) => setPhoneNumber(ev.target.value)}/></form></SlideDown>
+<SlideDown><form><input ref={inputRef} type="display" value={phoneNumber} onChange={(ev) => setPhoneNumber(ev.target.value)}/></form></SlideDown>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const inputRef = useRef(null);
<SlideDown><form><input ref={inputRef} type="display" value={phoneNumber} onChange={(ev) => setPhoneNumber(ev.target.value)}/></form></SlideDown>

const [phoneNumber, setPhoneNumber] = useState("");
const isCallDialed = useSelector(state => state.callDialed, shallowEqual);
const accountName = useSelector(state => state.accountName, shallowEqual);
Expand All @@ -156,7 +158,9 @@ function Dialer() {
}

function clear() {
setPhoneNumber("");
if (phoneNumber.length > 0) {
setPhoneNumber(phoneNumber.slice(0, -1));
}
}

const dialNumber = () => {
Expand Down Expand Up @@ -236,6 +240,22 @@ function Dialer() {
return () => clearInterval(interval);
}, [isCallDialed]);

useEffect(() => {
if (inputRef.current) {
const input = inputRef.current;

if (input.scrollWidth > input.clientWidth) {
input.classList.add('overflowing');
input.scrollLeft = input.scrollWidth;
} else {
input.classList.remove('overflowing');
}
}
}, [phoneNumber]);




return (
<div className="dialer">
<WSEventStream/>
Expand All @@ -256,7 +276,7 @@ function Dialer() {
</div>
))}


<SlideDown><form><input type="display" value={phoneNumber} onChange={(ev) => setPhoneNumber(ev.target.value)}/></form></SlideDown>

{loading &&
Expand Down Expand Up @@ -339,7 +359,19 @@ function App() {
},[dispatch])
return (
<Fragment>
<ToastContainer/>
<ToastContainer
position="top-right"
autoClose={5000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick={false}
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="light"
transition={Bounce}
/>
<header-nav>
<nav className="navbar" style={{backgroundColor: "rgb(40, 116, 240)"}}>
<div className="navbar-logo">
Expand Down
Loading