Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into testing
Browse files Browse the repository at this point in the history
  • Loading branch information
konzz committed Sep 12, 2024
2 parents 0debfc8 + 41c1119 commit 52a855e
Show file tree
Hide file tree
Showing 8 changed files with 196 additions and 269 deletions.
103 changes: 12 additions & 91 deletions app/react/App/styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -1716,14 +1716,6 @@ input[type="range"]::-ms-fill-lower {
margin: 0.5rem;
}

.m-4 {
margin: 1rem;
}

.m-5 {
margin: 1.25rem;
}

.m-auto {
margin: auto;
}
Expand Down Expand Up @@ -1822,10 +1814,6 @@ input[type="range"]::-ms-fill-lower {
margin-top: 0.5rem;
}

.mt-20 {
margin-top: 5rem;
}

.mt-4 {
margin-top: 1rem;
}
Expand Down Expand Up @@ -2108,10 +2096,6 @@ input[type="range"]::-ms-fill-lower {
width: 50%;
}

.w-60 {
width: 15rem;
}

.w-64 {
width: 16rem;
}
Expand Down Expand Up @@ -2194,10 +2178,6 @@ input[type="range"]::-ms-fill-lower {
min-width: 40rem;
}

.min-w-full {
min-width: 100%;
}

.max-w-20 {
max-width: 5rem;
}
Expand Down Expand Up @@ -2316,10 +2296,6 @@ input[type="range"]::-ms-fill-lower {
cursor: default;
}

.cursor-move {
cursor: move;
}

.cursor-not-allowed {
cursor: not-allowed;
}
Expand Down Expand Up @@ -2410,26 +2386,14 @@ input[type="range"]::-ms-fill-lower {
gap: 0.25rem;
}

.gap-10 {
gap: 2.5rem;
}

.gap-2 {
gap: 0.5rem;
}

.gap-3 {
gap: 0.75rem;
}

.gap-4 {
gap: 1rem;
}

.gap-5 {
gap: 1.25rem;
}

.gap-6 {
gap: 1.5rem;
}
Expand All @@ -2438,6 +2402,18 @@ input[type="range"]::-ms-fill-lower {
gap: 2rem;
}

.space-x-0 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(0px * var(--tw-space-x-reverse));
margin-left: calc(0px * calc(1 - var(--tw-space-x-reverse)));
}

.space-x-0\.5 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(0.125rem * var(--tw-space-x-reverse));
margin-left: calc(0.125rem * calc(1 - var(--tw-space-x-reverse)));
}

.space-x-1 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(0.25rem * var(--tw-space-x-reverse));
Expand All @@ -2450,12 +2426,6 @@ input[type="range"]::-ms-fill-lower {
margin-left: calc(0.5rem * calc(1 - var(--tw-space-x-reverse)));
}

.space-x-3 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(0.75rem * var(--tw-space-x-reverse));
margin-left: calc(0.75rem * calc(1 - var(--tw-space-x-reverse)));
}

.space-x-4 > :not([hidden]) ~ :not([hidden]) {
--tw-space-x-reverse: 0;
margin-right: calc(1rem * var(--tw-space-x-reverse));
Expand Down Expand Up @@ -2664,10 +2634,6 @@ input[type="range"]::-ms-fill-lower {
border-top-width: 1px;
}

.border-t-4 {
border-top-width: 4px;
}

.border-solid {
border-style: solid;
}
Expand Down Expand Up @@ -2863,21 +2829,11 @@ input[type="range"]::-ms-fill-lower {
background-color: rgb(229 231 235 / var(--tw-bg-opacity));
}

.bg-gray-400 {
--tw-bg-opacity: 1;
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
}

.bg-gray-50 {
--tw-bg-opacity: 1;
background-color: rgb(249 250 251 / var(--tw-bg-opacity));
}

.bg-gray-800 {
--tw-bg-opacity: 1;
background-color: rgb(31 41 55 / var(--tw-bg-opacity));
}

.bg-gray-900 {
--tw-bg-opacity: 1;
background-color: rgb(17 24 39 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -2948,11 +2904,6 @@ input[type="range"]::-ms-fill-lower {
background-color: rgb(238 242 255 / var(--tw-bg-opacity));
}

.bg-primary-600 {
--tw-bg-opacity: 1;
background-color: rgb(79 70 229 / var(--tw-bg-opacity));
}

.bg-primary-700 {
--tw-bg-opacity: 1;
background-color: rgb(67 56 202 / var(--tw-bg-opacity));
Expand Down Expand Up @@ -3184,22 +3135,10 @@ input[type="range"]::-ms-fill-lower {
padding-left: 0.25rem;
}

.pl-3 {
padding-left: 0.75rem;
}

.pl-4 {
padding-left: 1rem;
}

.pl-5 {
padding-left: 1.25rem;
}

.pl-7 {
padding-left: 1.75rem;
}

.pr-10 {
padding-right: 2.5rem;
}
Expand Down Expand Up @@ -3488,11 +3427,6 @@ input[type="range"]::-ms-fill-lower {
color: rgb(66 56 157 / var(--tw-text-opacity));
}

.text-indigo-900 {
--tw-text-opacity: 1;
color: rgb(54 47 120 / var(--tw-text-opacity));
}

.text-orange-400 {
--tw-text-opacity: 1;
color: rgb(255 138 76 / var(--tw-text-opacity));
Expand Down Expand Up @@ -4265,11 +4199,6 @@ input[type="range"]::-ms-fill-lower {
color: rgb(156 163 175 / var(--tw-placeholder-opacity));
}

:is(.dark .dark\:hover\:border-gray-500:hover) {
--tw-border-opacity: 1;
border-color: rgb(107 114 128 / var(--tw-border-opacity));
}

:is(.dark .dark\:hover\:\!bg-primary-700:hover) {
--tw-bg-opacity: 1 !important;
background-color: rgb(67 56 202 / var(--tw-bg-opacity)) !important;
Expand Down Expand Up @@ -4417,10 +4346,6 @@ input[type="range"]::-ms-fill-lower {
}

@media (min-width: 1024px) {
.lg\:grid {
display: grid;
}

.lg\:hidden {
display: none;
}
Expand All @@ -4439,10 +4364,6 @@ input[type="range"]::-ms-fill-lower {
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}

.lg\:grid-cols-3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lg\:px-6 {
padding-left: 1.5rem;
padding-right: 1.5rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,14 @@ const TwoFactorSetup = ({ closePanel, isOpen }: TwoFactorSetupProps) => {
size={180}
bgColor="white"
fgColor="black"
title="qr code"
/>
</div>
</Card>
<Card className="mb-4 sm:col-span-3" title={<Translate>Secret keys</Translate>}>
<CopyValueInput
value={_secret}
className="mb-4 w-full"
className="w-full mb-4"
label={
<>
<Translate className="block">
Expand Down Expand Up @@ -157,7 +158,7 @@ const TwoFactorSetup = ({ closePanel, isOpen }: TwoFactorSetupProps) => {
</div>
</Sidepanel.Body>
<Sidepanel.Footer className="px-4 py-3">
<div className="flex gap-2 w-full">
<div className="flex w-full gap-2">
<Button styling="light" onClick={closePanel} className="grow">
<Translate>Cancel</Translate>
</Button>
Expand Down
38 changes: 10 additions & 28 deletions app/react/V2/Routes/Settings/MenuConfig/MenuConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,23 @@ import { Link, sanitizeIds } from './shared';
const menuConfigloader =
(headers?: IncomingHttpHeaders): LoaderFunction =>
async () => {
const rowIds: string[] = [];
const tableRows = (await SettingsAPI.getLinks(headers)).map(link => {
const linkWithRowId: Link = { ...link, rowId: link._id! };
rowIds.push(link._id!);
if (link.sublinks) {
linkWithRowId.subRows = link.sublinks.map((sublink, index) => {
rowIds.push(`${link._id}-${index}`);
return {
...sublink,
rowId: `${link._id}-${index}`,
};
});
linkWithRowId.subRows = link.sublinks.map((sublink, index) => ({
...sublink,
rowId: `${link._id}-${index}`,
}));
}
return linkWithRowId;
});
return { links: tableRows, rowIds };
return tableRows;
};

const MenuConfig = () => {
const { links, rowIds } = useLoaderData() as { links: Link[]; rowIds: string[] };
const links = useLoaderData() as Link[];
const [linkState, setLinkState] = useState(links);
const nextRowIds = useRef(rowIds);
const prevLinks = useRef(links);
const [selectedLinks, setSelectedLinks] = useState<RowSelectionState>({});
const [isSidepanelOpen, setIsSidepanelOpen] = useState(false);
const setNotifications = useSetAtom(notificationAtom);
Expand All @@ -50,7 +45,7 @@ const MenuConfig = () => {
const [showModal, setShowModal] = useState(false);
const setSettings = useSetAtom(settingsAtom);

const areEqual = isEqual(rowIds, nextRowIds.current);
const areEqual = isEqual(linkState, prevLinks.current);

const blocker = useBlocker(!areEqual);

Expand Down Expand Up @@ -108,22 +103,9 @@ const MenuConfig = () => {
}, [blocker, setShowModal]);

useEffect(() => {
nextRowIds.current = rowIds;
prevLinks.current = links;
setLinkState(links);
//rowIds is derived from links, no need to add links to the deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [rowIds]);

useEffect(() => {
const updatedRowsIds: string[] = [];
linkState.forEach(link => {
updatedRowsIds.push(link.rowId!);
if (link.subRows) {
link.subRows.forEach(subRow => updatedRowsIds.push(subRow.rowId!));
}
});
nextRowIds.current = updatedRowsIds;
}, [rowIds, linkState]);
}, [links]);

return (
<div
Expand Down
8 changes: 5 additions & 3 deletions cypress/e2e/settings/account.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ describe('Account', () => {
let secret: string;

it('pass accessibility tests', () => {
cy.contains('button', 'Enable').click();
cy.get('#account-form').within(() => {
cy.contains('button', 'Enable').click({ force: true });
});
cy.contains('Using Authenticator');
cy.checkA11y();
});

it('should enable 2FA', () => {
// eslint-disable-next-line cypress/unsafe-to-chain-command
cy.getByTestId('copy-value-button').focus();
cy.getByTestId('copy-value-button').focus({ timeout: 5000 });
cy.getByTestId('copy-value-button').realClick();
cy.window()
.then(async win => win.navigator.clipboard.readText())
Expand Down
Loading

0 comments on commit 52a855e

Please sign in to comment.