Skip to content

Commit

Permalink
move sync to a modal
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-prins committed Dec 31, 2024
1 parent 2d49b35 commit e6d6582
Show file tree
Hide file tree
Showing 14 changed files with 340 additions and 233 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface AppNavLinkProps {
text?: string;
to: string;
visible?: boolean;
onClick?: () => void;
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
}

export const AppNavLink: FC<AppNavLinkProps> = props => {
Expand All @@ -92,11 +92,11 @@ export const AppNavLink: FC<AppNavLinkProps> = props => {
const match = useMatch({ path: `${to}/*` });
const isSelectedParentItem = inactive && !!match;
const showMenuSectionIcon = inactive && drawer.isOpen;
const handleClick = () => {
const handleClick = (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) => {
// reset the clicked nav path when navigating
// otherwise the child menu remains open
drawer.setClickedNavPath(undefined);
if (onClick) onClick();
if (onClick) onClick(e);
drawer.onClick();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,7 @@ export const Breadcrumb = styled(Link)({
});

export const Breadcrumbs = ({
topLevelPaths = [
AppRoute.Settings,
AppRoute.Sync,
AppRoute.Reports,
AppRoute.Help,
],
topLevelPaths = [AppRoute.Settings, AppRoute.Reports, AppRoute.Help],
}: {
topLevelPaths?: string[];
}) => {
Expand Down
2 changes: 0 additions & 2 deletions client/packages/common/src/utils/environment/EnvUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ const mapRoute = (route: string): RouteMapping => {
return { title: 'stock', docs: '/inventory/stock-view/' };
case inRoute(AppRoute.Stocktakes):
return { title: 'stocktakes', docs: '/inventory/stock-takes/' };
case inRoute(AppRoute.Sync):
return { title: 'sync', docs: '/sync/synchronisation/' };
case inRoute(AppRoute.Settings):
return { title: 'settings', docs: '/settings/' };
case inRoute(AppRoute.Patients):
Expand Down
2 changes: 0 additions & 2 deletions client/packages/config/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export enum AppRoute {

Messages = 'messages',

Sync = 'sync',

Settings = 'settings',

Help = 'help',
Expand Down
9 changes: 9 additions & 0 deletions client/packages/host/src/CommandK.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
import { AppRoute } from '@openmsupply-client/config';
import { Action } from 'kbar/lib/types';
import { useEasterEggModal } from './components/EasterEggModal';
import { useSyncModal } from './components/Sync';

const CustomKBarSearch = styled(KBarSearch)(({ theme }) => ({
width: 500,
Expand Down Expand Up @@ -90,6 +91,7 @@ const Actions = () => {
const t = useTranslation();
const { store, logout, user, userHasPermission } = useAuthContext();
const showEasterEgg = useEasterEggModal();
const showSync = useSyncModal();
const confirmLogout = useConfirmationModal({
onConfirm: () => {
logout();
Expand Down Expand Up @@ -275,6 +277,13 @@ const Actions = () => {
shortcut: ['h'],
perform: () => navigate(RouteBuilder.create(AppRoute.Help).build()),
},
{
id: 'action:sync',
name: `${t('sync')} (Alt+Control+S)`,
keywords: 'sync',
shortcut: ['Alt+Control+KeyS'],
perform: showSync,
},
];

if (userHasPermission(UserPermission.ServerAdmin)) {
Expand Down
Loading

0 comments on commit e6d6582

Please sign in to comment.