Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
therockerline committed May 20, 2024
2 parents 0b74aa4 + c2a44e3 commit d82a21c
Show file tree
Hide file tree
Showing 25 changed files with 444 additions and 334 deletions.
Binary file added public/TrayToolbarIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/TrayToolbarIcon20x20.png
Binary file not shown.
Binary file added public/TrayToolbarIconBlack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/TrayToolbarIconWhite.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 17 additions & 3 deletions src/main/classes/controllers/TrayController.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Menu, MenuItem, MenuItemConstructorOptions, Tray, app } from 'electron'
import { join } from 'path'
import { Menu, MenuItem, MenuItemConstructorOptions, Tray, app, nativeImage } from 'electron'
import path, { join } from 'path'
import { AccountController } from './AccountController'
import { LoginController } from './LoginController'
import { NethLinkController } from './NethLinkController'
Expand All @@ -14,8 +14,22 @@ export class TrayController {
static instance: TrayController
constructor() {
TrayController.instance = this
let image

this.tray = new Tray(join(__dirname, '../../public/TrayToolbarIcon20x20.png'))
//TODO Controllare con il process
if (process.platform === 'win32' || process.platform === 'linux') {
image = nativeImage.createFromPath(
path.join(__dirname, '../../public/TrayToolbarIconWhite.png')
).resize({ width: 18, height: 18 });
} else {
image = nativeImage.createFromPath(
path.join(__dirname, '../../public/TrayToolbarIconBlack.png')
).resize({ width: 18, height: 18 });
}



this.tray = new Tray(image)
this.tray.setIgnoreDoubleClickEvents(true)
this.tray.on('click', () => {
if (this.enableClick) {
Expand Down
87 changes: 42 additions & 45 deletions src/renderer/src/components/AddToPhonebookBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,18 @@ export function AddToPhonebookBox({
const submitButtonRef = useRef<HTMLButtonElement>(null)
const baseSchema = z.object({
privacy: z.string(),
extension: z.string().trim().regex(/^[0-9*#+]*$/, 'This is not a phone number'),
workphone: z.string().trim().regex(/^[0-9*#+]*$/, 'This is not a phone number'),
cellphone: z.string().trim().regex(/^[0-9*#+]*$/, 'This is not a phone number'),
extension: z
.string()
.trim()
.regex(/^[0-9*#+]*$/, 'This is not a phone number'),
workphone: z
.string()
.trim()
.regex(/^[0-9*#+]*$/, 'This is not a phone number'),
cellphone: z
.string()
.trim()
.regex(/^[0-9*#+]*$/, 'This is not a phone number'),
workemail: z.string(),
notes: z.string()
})
Expand Down Expand Up @@ -61,6 +70,7 @@ export function AddToPhonebookBox({
register,
watch,
handleSubmit,
setFocus,
setValue,
reset,
trigger,
Expand Down Expand Up @@ -92,30 +102,33 @@ export function AddToPhonebookBox({
}

useEffect(() => {
reset()
setValue('privacy', 'public')
setValue('type', 'person')

if (searchText !== undefined) {
if (validatePhoneNumber(searchText)) {
setValue('extension', searchText)
setTimeout(() => setFocus('name'), 10)
} else {
setValue('name', searchText)
setTimeout(() => setFocus('extension'), 10)
}
}
//Caso in cui ho selezionato da create in MISSEDCALL
if (selectedCompany) {
setValue('company', selectedCompany)
setTimeout(() => setFocus('extension'), 10)
}
if (selectedNumber) {
setValue('extension', selectedNumber)
setTimeout(() => setFocus('name'), 10)
}
}, [])

function handleSave(data: ContactType) {
//NETHVOICE usa il valore '-' quando si inserisce una company che e' priva di nome
//data.name === '' puo' essere vera solo nel caso in cui si inserisce una company
setIsLoading(true);
setIsLoading(true)
//Aggiunto un timeout per fare vedere lo spinner in quanto la chiamata e' troppo veloce
setTimeout(() => {
if (watchType === 'company') {
Expand All @@ -130,22 +143,24 @@ export function AddToPhonebookBox({
setIsLoading(false)
reset()
})
}, 300);
}, 300)
}

return (
<div className="w-full h-full">
<div className="flex justify-between items-center pb-4 border border-t-0 border-r-0 border-l-0 dark:border-gray-500 border-gray-300 max-h-[28px] px-5">
<h1 className="font-medium text-[14px] leading-5">{t('Phonebook.Add to Phonebook')}</h1>
<div className="flex justify-between items-center pb-4 border border-t-0 border-r-0 border-l-0 dark:border-borderDark border-borderLight max-h-[28px] px-5">
<h1 className="font-medium text-[14px] leading-5 dark:text-titleDark text-titleLight">
{t('Phonebook.Add to Phonebook')}
</h1>
</div>
<form
className="flex flex-col gap-4 p-2 h-full overflow-y-auto max-h-[245px] px-5"
className="flex flex-col gap-5 p-2 h-full overflow-y-auto max-h-[240px] px-5"
onSubmit={(e) => {
e.preventDefault()
handleSubmit(onSubmitForm)(e)
}}
>
<label className="flex flex-col gap-2 dark:text-gray-50 text-gray-900">
<label className="flex flex-col gap-2 dark:text-titleDark text-titleLight">
<p className="font-medium text-[14px] leading-5">{t('Phonebook.Visibility')}</p>
<div className="flex flex-row gap-8 items-center">
<div className="flex flex-row gap-2 items-center">
Expand All @@ -155,7 +170,7 @@ export function AddToPhonebookBox({
type="radio"
value="public"
name="visibility"
className="h-4 w-4 dark:text-blue-500 text-blue-700 dark:focus:ring-blue-200 focus:ring-blue-500 dark:focus:ring-offset-gray-900 focus:ring-offset-gray-50"
className="h-4 w-4 dark:text-textBlueDark text-textBlueLight dark:focus:ring-ringBlueDark focus:ring-ringBlueLight focus:ring-offset-ringOffsetLight dark:focus:ring-offset-ringOffsetDark"
/>
<label
htmlFor="public"
Expand All @@ -171,7 +186,7 @@ export function AddToPhonebookBox({
type="radio"
value="private"
name="visibility"
className="h-4 w-4 dark:text-blue-500 text-blue-700 dark:focus:ring-blue-200 focus:ring-blue-500 dark:focus:ring-offset-gray-900 focus:ring-offset-gray-50"
className="h-4 w-4 dark:text-textBlueDark text-textBlueLight dark:focus:ring-ringBlueDark focus:ring-ringBlueLight dark:focus:ring-offset-ringOffsetDark focus:ring-offset-ringOffsetLight"
/>
<label
htmlFor="private"
Expand All @@ -183,7 +198,7 @@ export function AddToPhonebookBox({
</div>
</label>

<label className="flex flex-col gap-2 dark:text-gray-50 text-gray-900">
<label className="flex flex-col gap-2 dark:text-titleDark text-titleLight">
<p className="font-medium text-[14px] leading-5">{t('Phonebook.Type')}</p>
<div className="flex flex-row gap-8 items-center">
<div className="flex flex-row gap-2 items-center">
Expand All @@ -193,7 +208,7 @@ export function AddToPhonebookBox({
type="radio"
value="person"
name="type"
className="h-4 w-4 dark:text-blue-500 text-blue-700 dark:focus:ring-blue-200 focus:ring-blue-500 dark:focus:ring-offset-gray-900 focus:ring-offset-gray-50"
className="h-4 w-4 dark:text-textBlueDark text-textBlueLight dark:focus:ring-ringBlueDark focus:ring-ringBlueLight dark:focus:ring-offset-ringOffsetDark focus:ring-offset-ringOffsetLight"
/>
<label
htmlFor="person"
Expand All @@ -209,7 +224,7 @@ export function AddToPhonebookBox({
type="radio"
value="company"
name="type"
className="h-4 w-4 dark:text-blue-500 text-blue-700 dark:focus:ring-blue-200 focus:ring-blue-500 dark:focus:ring-offset-gray-900 focus:ring-offset-gray-50"
className="h-4 w-4 dark:text-textBlueDark text-textBlueLight dark:focus:ring-ringBlueDark focus:ring-ringBlueLight dark:focus:ring-offset-ringOffsetDark focus:ring-offset-ringOffsetLight"
/>
<label
htmlFor="company"
Expand All @@ -236,7 +251,7 @@ export function AddToPhonebookBox({
handleSubmit(onSubmitForm)(e)
}
}}
className={`font-normal text-[14px] leading-5 ${errors.name?.message ? `mb-2` : ``} dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white`}
className="font-normal text-[14px] leading-5"
/>
</>
) : null}
Expand All @@ -253,16 +268,13 @@ export function AddToPhonebookBox({
handleSubmit(onSubmitForm)(e)
}
}}
className={`font-normal text-[14px] leading-5 ${errors.company?.message ? `mb-2` : ``} dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white`}
className="font-normal text-[14px] leading-5"
/>

<TextInput
{...register('extension')}
type="tel"
minLength={3}
// onChange={(e) => {
// setValue('extension', e.target.value.replace(/[^\d*#+]/g, ''))
// }}
label={t('Phonebook.Phone number') as string}
helper={errors.extension?.message || undefined}
error={!!errors.extension?.message}
Expand All @@ -273,16 +285,13 @@ export function AddToPhonebookBox({
handleSubmit(onSubmitForm)(e)
}
}}
className="font-normal text-[14px] leading-5 dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white"
className="font-normal text-[14px] leading-5"
/>

<TextInput
{...register('workphone')}
type="tel"
minLength={3}
// onChange={(e) => {
// setValue('workphone', e.target.value.replace(/[^\d*#+]/g, ''))
// }}
label={t('Phonebook.Work phone') as string}
helper={errors.workphone?.message || undefined}
error={!!errors.workphone?.message}
Expand All @@ -293,16 +302,13 @@ export function AddToPhonebookBox({
handleSubmit(onSubmitForm)(e)
}
}}
className="font-normal text-[14px] leading-5 dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white"
className="font-normal text-[14px] leading-5"
/>

<TextInput
{...register('cellphone')}
type="tel"
minLength={3}
// onChange={(e) => {
// setValue('cellphone', e.target.value.replace(/[^\d*#+]/g, ''))
// }}
label={t('Phonebook.Mobile phone') as string}
helper={errors.cellphone?.message || undefined}
error={!!errors.cellphone?.message}
Expand All @@ -313,7 +319,7 @@ export function AddToPhonebookBox({
handleSubmit(onSubmitForm)(e)
}
}}
className="font-normal text-[14px] leading-5 dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white"
className="font-normal text-[14px] leading-5"
/>

<TextInput
Expand All @@ -327,7 +333,7 @@ export function AddToPhonebookBox({
handleSubmit(onSubmitForm)(e)
}
}}
className="font-normal text-[14px] leading-5 dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white"
className="font-normal text-[14px] leading-5"
/>

<TextInput
Expand All @@ -341,32 +347,23 @@ export function AddToPhonebookBox({
handleSubmit(onSubmitForm)(e)
}
}}
className="font-normal text-[14px] leading-5 dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white"
className="font-normal text-[14px] leading-5"
/>

<div className="flex flex-row gap-4 justify-end mb-1">
<Button
variant="ghost"
onClick={() => onCancel()}
disabled={isLoading}
className="dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white"
>
<p className="dark:text-blue-500 text-blue-700 font-medium text-[14px] leading-5">
<Button variant="ghost" onClick={() => onCancel()} disabled={isLoading}>
<p className="dark:text-textBlueDark text-textBlueLight font-medium text-[14px] leading-5">
{t('Common.Cancel')}
</p>
</Button>
<Button
type="submit"
ref={submitButtonRef}
className="gap-3 dark:bg-blue-500 bg-blue-700 dark:hover:bg-blue-300 hover:bg-blue-800 dark:focus:ring-2 dark:focus:ring-offset-2 dark:focus:ring-blue-200 dark:focus:ring-offset-gray-900 focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 focus:ring-offset-white"
>
<p className="dark:text-gray-950 text-gray-50 font-medium text-[14px] leading-5">
<Button type="submit" ref={submitButtonRef} className="gap-3">
<p className="dark:text-titleLight text-titleDark font-medium text-[14px] leading-5">
{t('Common.Save')}
</p>
{isLoading && (
<FontAwesomeIcon
icon={LoadingIcon}
className="dark:text-gray-900 text-gray-50 animate-spin"
className="dark:text-titleLight text-titleDark animate-spin"
/>
)}
</Button>
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/src/components/DisplayedAccountLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export function DisplayedAccountLogin({
<div
onClick={() => handleClick?.()}
className={classNames(
'w-full flex flex-row gap-7 items-center justify-start bg-transparent h-20 rounded-lg text-gray-900 dark:text-gray-50 cursor-pointer',
handleClick ? 'hover:bg-gray-200 dark:hover:bg-gray-800' : ''
'w-full flex flex-row gap-7 items-center justify-start bg-transparent h-20 rounded-lg text-titleLight dark:text-titleDark cursor-pointer',
handleClick ? 'hover:bg-hoverLight dark:hover:bg-hoverDark' : ''
)}
>
<div className="ml-5 w-12 h-12 rounded-full overflow-hidden">
Expand Down
12 changes: 7 additions & 5 deletions src/renderer/src/components/MissedCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ export function MissedCall({
/>
)}
</div>
<div className="flex flex-col gap-1 dark:text-gray-50 text-gray-900">
<div className="flex flex-col gap-1 dark:text-titleDark text-titleLight">
<p className="font-medium text-[14px] leading-5">{truncate(getCallName(call), 15)}</p>
<div className="flex flex-row gap-2 items-center">
<MissedCallIcon />
<NumberCaller
number={getCallExt(call)}
disabled={!isCallsEnabled}
className={"dark:text-blue-500 text-blue-700 font-normal text-[14px] leading-5 hover:underline"}
className={"dark:text-textBlueDark text-textBlueLight font-normal text-[14px] leading-5 hover:underline"}
>
{call.cnum}
</NumberCaller>
Expand Down Expand Up @@ -148,14 +148,16 @@ export function MissedCall({
{showCreateButton && (
<Button
variant="ghost"
className="flex gap-3 items-center py-2 px-3 border dark:border-gray-700 border-gray-200 ml-auto dark:focus:ring-2 focus:ring-2 dark:focus:ring-blue-200 focus:ring-blue-500"
className="flex gap-3 items-center py-2 px-3 border dark:border-borderDark border-borderLight ml-auto"
onClick={() => handleSelectedMissedCall(call.cnum, call.ccompany)}
>
<FontAwesomeIcon
className="text-base dark:text-blue-500 text-blue-700"
className="text-base dark:text-textBlueDark text-textBlueLight"
icon={AddUserIcon}
/>
<p className="dark:text-blue-500 text-blue-700 font-medium">{t('SpeedDial.Create')}</p>
<p className="dark:text-textBlueDark text-textBlueLight font-medium">
{t('SpeedDial.Create')}
</p>
</Button>
)}
</div>
Expand Down
16 changes: 9 additions & 7 deletions src/renderer/src/components/MissedCallsBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,20 @@ export function MissedCallsBox({
return (
<>
<div className="flex flex-col h-full">
<div className="flex justify-between items-center pb-4 border border-t-0 border-r-0 border-l-0 dark:border-gray-700 border-gray-200 max-h-[28px] px-5 mt-3">
<h1 className="font-medium text-[14px] leading-5">{title}</h1>
<div className="flex justify-between items-center pb-4 border border-t-0 border-r-0 border-l-0 dark:border-borderDark border-borderLight max-h-[28px] px-5 mt-3">
<h1 className="font-medium text-[14px] leading-5 dark:text-titleDark text-titleLight">
{title}
</h1>
<Button
variant="ghost"
className="flex gap-3 items-center pt-2 pr-1 pb-2 pl-1 hover:bg-gray-200 dark:hover:bg-gray-800 dark:focus:ring-2 focus:ring-2 dark:focus:ring-blue-200 focus:ring-blue-500"
className="flex gap-3 items-center pt-2 pr-1 pb-2 pl-1"
onClick={viewAllMissedCalls}
>
<FontAwesomeIcon
className="text-base dark:text-blue-500 text-blue-700"
className="text-base dark:text-textBlueDark text-textBlueLight"
icon={ShowMissedCallIcon}
/>
<p className="dark:text-blue-500 text-blue-700 font-medium text-[14px] leading-5">
<p className="dark:text-textBlueDark text-textBlueLight font-medium text-[14px] leading-5">
{t('Common.View all')}
</p>
</Button>
Expand All @@ -46,12 +48,12 @@ export function MissedCallsBox({
{missedCallsIn.map((call, idx) => {
return (
<div
className={`${idx === missedCallsIn.length - 1 ? `` : `border-b dark:border-gray-700 border-gray-200`}`}
className={`${idx === missedCallsIn.length - 1 ? `` : `border-b dark:border-borderDark border-borderLight`}`}
key={idx}
>
<MissedCall
call={call}
className="dark:hover:bg-gray-800 hover:bg-gray-200"
className="dark:hover:bg-hoverDark hover:bg-hoverLight"
handleSelectedMissedCall={handleSelectedMissedCall}
/>
</div>
Expand Down
Loading

0 comments on commit d82a21c

Please sign in to comment.