Skip to content

Commit

Permalink
Toast: info for users looking for closed diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
bindeali committed Feb 5, 2024
1 parent af59343 commit e25b3a4
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/config/LocalStorageVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ export type LocalStorageVars =
| "canvasLanguage"
| "lastViewedVersion"
| "defaultCardinalitySource"
| "defaultCardinalityTarget";
| "defaultCardinalityTarget"
| "shownToasts";
1 change: 1 addition & 0 deletions src/config/ToastData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AppSettings } from "./Variables";

export const ToastData: { [Key in keyof typeof enToast]: ToastType } = {
lookingForRelationshipsOrProperties: { repeatable: false },
diagramsClosedByDefault: { repeatable: false },
};

export type ToastType = {
Expand Down
5 changes: 5 additions & 0 deletions src/locale/cstoast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ export const csToast: {
content:
"V kompaktním pohledu můžete používat typy vztahů vytvořené v jiných nástrojích při vytváření nových vztahů mezi pojmy. Vlastnosti se spravují v detailu pojmů.",
},
diagramsClosedByDefault: {
header: "Hledáte své diagramy?",
content:
"V nové verzi OntoGrapheru byly uzavřeny všechny diagramy. Pro jejich znovuotevření použijte tlačítko Otevřít diagram, které se zobrazí při najetí myší na položku diagramu v domovské kartě.",
},
};
5 changes: 5 additions & 0 deletions src/locale/entoast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ export const enToast: {
content:
"In Compact view, you can use relators created in other tools when creating a new relationship. Tropes are managed in concepts' detail panel",
},
diagramsClosedByDefault: {
header: "Looking for your diagram tabs?",
content:
"In the new version of OntoGrapher, all diagrams have been closed for performance reasons. To open them again, use the Open diagram button when hovering over a diagram in the list on the Home tab.",
},
};
2 changes: 2 additions & 0 deletions src/main/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { updateVocabularyAnnotations } from "../queries/update/UpdateChangeQueri
import { updateDiagramMetadata } from "../queries/update/UpdateDiagramQueries";
import { MainView } from "./MainView";
import { ToastService } from "./ToastService";
import { callToast } from "../config/ToastData";

interface DiagramAppProps {}

Expand Down Expand Up @@ -159,6 +160,7 @@ export default class App extends React.Component<
s.mainViewMode = MainViewMode.MANAGER;
});
this.handleWorkspaceReady();
callToast("diagramsClosedByDefault");
};
if (Environment.debug && loadDebugData()) finishUp();
else
Expand Down
5 changes: 3 additions & 2 deletions src/main/ToastService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { StoreSettings } from "../config/Store";
import { ToastData } from "../config/ToastData";
import { AppSettings } from "../config/Variables";
import _ from "lodash";
import { getLocalStorageKey } from "../function/FunctionGetVars";

export const ToastService: React.FC = () => {
const toasts = useStoreState(StoreSettings, (s) => s.toastQueue);
Expand All @@ -14,7 +15,7 @@ export const ToastService: React.FC = () => {
ToastData[toast].action;

useEffect(() => {
const shownToasts = localStorage.getItem("og:shownToasts");
const shownToasts = localStorage.getItem(getLocalStorageKey("shownToasts"));
if (shownToasts) AppSettings.shownToasts = JSON.parse(shownToasts);
}, []);

Expand All @@ -32,7 +33,7 @@ export const ToastService: React.FC = () => {
toast,
]);
localStorage.setItem(
"og:shownToasts",
getLocalStorageKey("shownToasts"),
JSON.stringify(AppSettings.shownToasts)
);
}
Expand Down
4 changes: 4 additions & 0 deletions src/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ body {
white-space: normal;
}

.toast {
margin: 5px;
}

.inert {
display: inline-flex;
}
Expand Down

0 comments on commit e25b3a4

Please sign in to comment.