Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Контекстная справка #233

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 24 additions & 50 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
"@codemirror/lang-xml": "^6.0.2",
"@electron-toolkit/preload": "^2.0.0",
"@electron-toolkit/utils": "^1.0.2",
"@floating-ui/react": "^0.24.8",
"@floating-ui/react-dom": "^2.0.1",
"@floating-ui/react": "^0.26.9",
"@floating-ui/react-dom": "^2.0.8",
"@radix-ui/react-checkbox": "^1.0.4",
"@types/ws": "^8.5.10",
"@uiw/react-codemirror": "^4.21.21",
Expand Down
1 change: 1 addition & 0 deletions resources/tutorial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"items":{"1":{"title":"Пример","content":"Попробуй добавить новый компонент","showed":true},"2":{"title":"Иерархия состояний","content":"Иерархия состояний позволяет посмотреть компоненты схемы ввиде списка","showed":true}}}
6 changes: 6 additions & 0 deletions src/main/file-handlers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
handleOpenPlatformFile,
handleGetFileMetadata,
} from './handlers';
import { getAllTemplates, getTemplate } from './templates';
import { getTutorial, markTutorialItemAsShowed } from './tutorial';

/**
* В этом файле происходит типизация IPC
Expand All @@ -26,6 +28,10 @@ const handlers = {
getPlatforms: searchPlatforms,
openPlatformFile: handleOpenPlatformFile,
getMetadata: handleGetFileMetadata,
getAllTemplates,
getTemplate,
getTutorial,
markTutorialItemAsShowed,
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/templates.ts → src/main/file-handlers/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export const getAllTemplates = async () => {
const dirs = (await readdir(templatesPath, { withFileTypes: true }))
.filter((dirent) => dirent.isDirectory())
.map((dir) => dir.name);
const result = {};
const result: Record<string, string[]> = {};

for (const dirName of dirs) {
result[dirName] = (await readdir(path.join(templatesPath, dirName))).map(removeExtension);
}

return result;
} catch (error) {
return [];
return {};
}
};

Expand Down
Loading