Skip to content

Commit

Permalink
fix: restored settings view
Browse files Browse the repository at this point in the history
  • Loading branch information
gnekoz authored Sep 7, 2022
1 parent 15008f0 commit 5d43958
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 81 deletions.
148 changes: 73 additions & 75 deletions src/views/settings/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
/* eslint-disable no-nested-ternary */
import { getBridgedFunctions } from '@zextras/carbonio-shell-ui';
import { isEqual, transform, isObject, filter, reduce } from 'lodash';
import { t } from '@zextras/carbonio-shell-ui';
import { filter, isEqual, isObject, reduce, transform } from 'lodash';

export const differenceObject = (object, base) => {
// eslint-disable-next-line no-shadow
Expand All @@ -17,6 +17,7 @@ export const differenceObject = (object, base) => {
}
});
}

return changes(object, base);
};

Expand All @@ -32,7 +33,7 @@ export const getPropsDiff = (original, modified) =>
{}
);

export const CheckNewMailOptions = (t, isSecondsFormat, isMinutesFormat) => [
export const CheckNewMailOptions = (isSecondsFormat, isMinutesFormat) => [
{
label: t('settings.new_mail_optn.manually', 'Manually'),
value: isMinutesFormat ? '31536000' : isSecondsFormat ? '31536000s' : '31536000'
Expand Down Expand Up @@ -130,12 +131,12 @@ export const CheckNewMailOptions = (t, isSecondsFormat, isMinutesFormat) => [
value: isMinutesFormat ? '15m' : isSecondsFormat ? '900s' : '900'
}
];
export const DisplayMailOptions = (t) => [
export const DisplayMailOptions = () => [
{ label: t('settings.display_mail_options.html', 'As HTML(When Possible)'), value: 'TRUE' },
{ label: t('settings.display_mail_options.text', 'As text'), value: 'FALSE' }
];

export const MessageSelectionOptions = (t) => [
export const MessageSelectionOptions = () => [
{
label: t(
'settings.msg_selection_optn.below_deleted',
Expand All @@ -159,7 +160,7 @@ export const MessageSelectionOptions = (t) => [
}
];

export const NotifyFolderOpts = (t) => [
export const NotifyFolderOpts = () => [
{
label: t(
'settings.notify_folder_optn.new_message_inbox',
Expand All @@ -176,13 +177,13 @@ export const NotifyFolderOpts = (t) => [
}
];

export const ReadReceiptOpts = (t) => [
export const ReadReceiptOpts = () => [
{ label: t('settings.read_rcpt_optn.never', 'Never send a read reciept'), value: 'never' },
{ label: t('settings.read_rcpt_optn.always', 'Always send a read reciept'), value: 'always' },
{ label: t('settings.read_rcpt_optn.ask_me', 'Ask me'), value: 'prompt' }
];

export const MsgsFromMeOpts = (t) => [
export const MsgsFromMeOpts = () => [
{ label: t('settings.msg_from_optn.inbox', 'Place in inbox'), value: 'dedupeNone' },
{
label: t('settings.msg_from_optn.inbox_if_cc', "Place in inbox if I'm in To: or Cc:"),
Expand All @@ -194,7 +195,7 @@ export const MsgsFromMeOpts = (t) => [
}
];

export const ReadSignatureSettings = (t) => [
export const ReadSignatureSettings = () => [
{ label: t('settings.msg_from_optn.inbox', 'Place in inbox'), value: 'dedupeNone' },
{
label: t('settings.msg_from_optn.inbox_if_cc', "Place in inbox if I'm in To: or Cc:"),
Expand All @@ -208,145 +209,142 @@ export const ReadSignatureSettings = (t) => [

export const getFontSizesOptions = () => [
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '8',
defaultValue: '{{count}} pt'
}),
value: '8pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '9',
defaultValue: '{{count}} pt'
}),
value: '9pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '10',
defaultValue: '{{count}} pt'
}),
value: '10pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '11',
defaultValue: '{{count}} pt'
}),
value: '11pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '12',
defaultValue: '{{count}} pt'
}),
value: '12pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '13',
defaultValue: '{{count}} pt'
}),
value: '13pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '14',
defaultValue: '{{count}} pt'
}),
value: '14pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '16',
defaultValue: '{{count}} pt'
}),
value: '16pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '18',
defaultValue: '{{count}} pt'
}),
value: '18pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '24',
defaultValue: '{{count}} pt'
}),
value: '24pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '36',
defaultValue: '{{count}} pt'
}),
value: '36pt'
},
{
label: getBridgedFunctions()?.t('settings.font_size', {
label: t('settings.font_size', {
count: '48',
defaultValue: '{{count}} pt'
}),
value: '48pt'
}
];

export const getFonts = () => {
const bridgedFn = getBridgedFunctions();
return [
{
label: bridgedFn?.t('settings.fonts.sans_serif', 'Sans Serif'),
value: 'arial,helvetica,sans-serif'
},
{
label: bridgedFn?.t('settings.fonts.serif', 'Serif'),
value: 'times new roman,new york,times,serif'
},
{
label: bridgedFn?.t('settings.fonts.wide_block', 'Wide Block'),
value: 'arial black,avant garde'
},
{
label: bridgedFn?.t('settings.fonts.monospaced', 'Monospaced'),
value: 'courier new,courier,monaco,monospace,sans-serif'
},
{
label: bridgedFn?.t('settings.fonts.comic', 'Comic'),
value: 'comic sans ms,comic sans,sans-serif'
},
{
label: bridgedFn?.t('settings.fonts.console', 'Console'),
value: 'lucida console,sans-serif'
},
{
label: bridgedFn?.t('settings.fonts.garamond', 'Garamond'),
value: 'garamond,new york,times,serif'
},
{
label: bridgedFn?.t('settings.fonts.elegant', 'Elegant'),
value: 'georgia,serif'
},
{
label: bridgedFn?.t('settings.fonts.professional', 'Professional'),
value: 'tahoma,new york,times,serif'
},
{
label: bridgedFn?.t('settings.fonts.terminal', 'Terminal'),
value: 'terminal,monaco'
},
{
label: bridgedFn?.t('settings.fonts.modern', 'Modern'),
value: 'trebuchet ms,sans-serif'
},
{
label: bridgedFn?.t('settings.fonts.wide', 'Wide'),
value: 'verdana,helvetica,sans-serif'
}
];
};
export const ConversationSortingSettings = (t) => [
export const getFonts = () => [
{
label: t('settings.fonts.sans_serif', 'Sans Serif'),
value: 'arial,helvetica,sans-serif'
},
{
label: t('settings.fonts.serif', 'Serif'),
value: 'times new roman,new york,times,serif'
},
{
label: t('settings.fonts.wide_block', 'Wide Block'),
value: 'arial black,avant garde'
},
{
label: t('settings.fonts.monospaced', 'Monospaced'),
value: 'courier new,courier,monaco,monospace,sans-serif'
},
{
label: t('settings.fonts.comic', 'Comic'),
value: 'comic sans ms,comic sans,sans-serif'
},
{
label: t('settings.fonts.console', 'Console'),
value: 'lucida console,sans-serif'
},
{
label: t('settings.fonts.garamond', 'Garamond'),
value: 'garamond,new york,times,serif'
},
{
label: t('settings.fonts.elegant', 'Elegant'),
value: 'georgia,serif'
},
{
label: t('settings.fonts.professional', 'Professional'),
value: 'tahoma,new york,times,serif'
},
{
label: t('settings.fonts.terminal', 'Terminal'),
value: 'terminal,monaco'
},
{
label: t('settings.fonts.modern', 'Modern'),
value: 'trebuchet ms,sans-serif'
},
{
label: t('settings.fonts.wide', 'Wide'),
value: 'verdana,helvetica,sans-serif'
}
];
export const ConversationSortingSettings = () => [
{ label: t('settings.conv_sort_option.desc', 'From new to old'), value: 'dateDesc' },
{ label: t('settings.conv_sort_option.asc', 'From old to new'), value: 'dateAsc' }
];
Expand Down
8 changes: 4 additions & 4 deletions src/views/settings/receiving-messages-settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export default function ReceivingMessagesSettings({
updateProps
}) {
const [t] = useTranslation();
const notifyFolderOptn = useMemo(() => NotifyFolderOpts(t), [t]);
const readReceiptOptn = useMemo(() => ReadReceiptOpts(t), [t]);
const msgsFromMeOpts = useMemo(() => MsgsFromMeOpts(t), [t]);
const sectionTitle = useMemo(() => receivingMessagesSubSection(t), [t]);
const notifyFolderOptn = useMemo(() => NotifyFolderOpts(), []);
const readReceiptOptn = useMemo(() => ReadReceiptOpts(), []);
const msgsFromMeOpts = useMemo(() => MsgsFromMeOpts(), []);
const sectionTitle = useMemo(() => receivingMessagesSubSection(), []);

const mailNotificationSoundDefault = useMemo(
() =>
Expand Down
4 changes: 2 additions & 2 deletions src/views/settings/signature-settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export default function SignatureSettings({
type="outlined"
color="error"
onClick={() => onDelete()}
isSmall
size="small"
/>
)}
</Container>
Expand Down Expand Up @@ -227,7 +227,7 @@ export default function SignatureSettings({
type="outlined"
onClick={createSign}
disabled={signItems?.length && !name}
size="fill"
width="fill"
/>
</Container>
<Padding all="small" />
Expand Down
16 changes: 16 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,22 @@
"filter_folder_message": "Select a folder to apply your filter:",
"filter_name": "Filter Name",
"font": "Font",
"font_size": "{{count}} pt",
"font_size_plural": "",
"fonts": {
"comic": "Comic",
"console": "Console",
"elegant": "Elegant",
"garamond": "Garamond",
"modern": "Modern",
"monospaced": "Monospaced",
"professional": "Professional",
"sans_serif": "Sans Serif",
"serif": "Serif",
"terminal": "Terminal",
"wide": "Wide",
"wide_block": "Wide Block"
},
"from_distribution_list": "from distribution list",
"gb": "GB",
"header_name": "Header Named",
Expand Down

0 comments on commit 5d43958

Please sign in to comment.