Skip to content

Commit

Permalink
Merge pull request #195 from MakinoharaShoko/dev
Browse files Browse the repository at this point in the history
4.4.7
  • Loading branch information
MakinoharaShoko authored Nov 23, 2023
2 parents 622e9dd + 73e42fc commit 4663e0e
Show file tree
Hide file tree
Showing 63 changed files with 968 additions and 494 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webgal-terre",
"version": "4.4.6",
"version": "4.4.7",
"private": true,
"scripts": {
"dev": "concurrently \"yarn dev:terre\" \"yarn dev:origine\" \"yarn dev:start-dev-server\"",
Expand All @@ -9,6 +9,7 @@
"dev:terre": "cd packages/terre2 && yarn start:debug",
"dev:origine": "cd packages/origine2 && vite --host=3002",
"dev:start-dev-server": "cd packages/dev-server && node index.js",
"openapi": "cd packages/origine2 && yarn openapi",
"lint:terre": "cd packages/terre2 && yarn lint",
"lint:origine": "cd packages/origine2 && yarn lint"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/origine2/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webgal-origine-2",
"private": true,
"version": "4.4.6",
"version": "4.4.7",
"license": "MPL-2.0",
"scripts": {
"dev": "vite --host=3000",
Expand Down Expand Up @@ -34,7 +34,7 @@
"react-redux": "^8.0.1",
"sass": "^1.51.0",
"swr": "^2.2.4",
"webgal-parser": "^4.4.5-fix2"
"webgal-parser": "^4.4.7"
},
"devDependencies": {
"@types/lodash": "^4.14.182",
Expand Down
6 changes: 3 additions & 3 deletions packages/origine2/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
}

.App-header {
background-color: #282c34;
background-color: var(--app-header-background);
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
color: var(--app-header);
}

.App-link {
color: #61dafb;
color: var(--app-link);
}

@keyframes App-logo-spin {
Expand Down
2 changes: 1 addition & 1 deletion packages/origine2/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {mapLspKindToMonacoKind} from "./pages/editor/TextEditor/convert";
import * as monaco from "monaco-editor";
import Translation from "./components/translation/Translation";
import {lspSceneName} from "@/runtime/WG_ORIGINE_RUNTIME";

import './config/themes/theme.css';

function App() {
useEffect(() => {
Expand Down
15 changes: 15 additions & 0 deletions packages/origine2/src/api/Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,21 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
...params,
}),

/**
* No description
*
* @tags Manage Game
* @name ManageGameControllerOpenGameDict
* @summary Open Game Dictionary
* @request GET:/api/manageGame/openGameDict/{gameName}
*/
manageGameControllerOpenGameDict: (gameName: string, params: RequestParams = {}) =>
this.request<void, any>({
path: `/api/manageGame/openGameDict/${gameName}`,
method: 'GET',
...params,
}),

/**
* No description
*
Expand Down
11 changes: 5 additions & 6 deletions packages/origine2/src/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,20 @@
font-size: 90%;
//margin: 0 0 0 5px;
padding: 2px 5px 2px 5px;
color: #005caf;
//background: rgba(0,92,175,0.1);
color: var(--terre-primary);
cursor: pointer;
//border-radius: 4px;
border-left: 1px solid rgba(0, 0, 0, 0.1);
border-left: 1px solid var(--common-tag_title_button);

transition: background-color 0.33s, border-left-color 0.33s;

&:first-child {
border-left: 1px solid rgba(0, 0, 0, 0);
border-left: 1px solid var(--common-tag_title_button-first-child-border-left);
}

&:hover {
border-left: 1px solid rgba(0, 0, 0, 0);
background: rgba(0, 0, 0, 0.1);
border-left: 1px solid var(--common-tag_title_button-hover-border-left);
background: var(--common-tag_title_button-hover-background);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

.title{
font-size: 90%;
color: #005caf;
color: var(--terre-primary);
font-weight: bold;
}

Expand Down
11 changes: 5 additions & 6 deletions packages/origine2/src/components/message/message.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
}

.singleMessage {
//background-color: rgba(0, 92, 175, 0.95);
//border: 1px solid #0B346E;
background-color: rgba(250,252,255,1);
//border: 1px solid;
background-color: var(--singleMessage-background);
font-size: 115%;
color: #0B346E;
color: var(--singleMessage);
padding: 0.5em 0.5em 0.5em 0.5em;
margin: 0.5em 0.5em 0.5em 0.5em;
min-width: 350px;
border-radius: 4px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border: 1px solid rgba(0,0,0,0.1);
box-shadow: 0 0 10px var(--singleMessage-box-shadow);
border: 1px solid var(--singleMessage-border);
}
2 changes: 1 addition & 1 deletion packages/origine2/src/config/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ export interface Info {
}

export const __INFO: Info = {
version: '4.4.6.4',
version: '4.4.7',
buildTime: '2023-10-28T09:57:19.863Z', // 编译时会通过 version-sync.js 自动更新
};
25 changes: 25 additions & 0 deletions packages/origine2/src/config/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,31 @@
]
}
},
"/api/manageGame/openGameDict/{gameName}": {
"get": {
"operationId": "ManageGameController_openGameDict",
"summary": "Open Game Dictionary",
"parameters": [
{
"name": "gameName",
"required": true,
"in": "path",
"description": "Name of the game.",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Opens the dictionary for a specified game."
}
},
"tags": [
"Manage Game"
]
}
},
"/api/manageGame/openGameAssetsDict/{gameName}": {
"get": {
"operationId": "ManageGameController_openGameAssetsDict",
Expand Down
113 changes: 113 additions & 0 deletions packages/origine2/src/config/themes/theme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
:root {
--black: rgba(0, 0, 0, 1);
--black-0pct: rgba(0, 0, 0, 0);
--black-5pct: rgba(0, 0, 0, 0.05);
--black-7pct: rgba(0, 0, 0, 0.07);
--black-10pct: rgba(0, 0, 0, 0.1);
--black-15pct: rgba(0, 0, 0, 0.15);
--black-35pct: rgba(0, 0, 0, 0.35);
--black-50pct: rgba(0, 0, 0, 0.5);
--black-75pct: rgba(0, 0, 0, 0.75);
--gray-dark: rgba(40, 44, 52, 1);
--gray-51: rgba(51, 51, 51, 1);
--gray-102: rgba(102, 102, 102, 1);
--gray-153: rgba(153, 153, 153, 1);
--gray-204: rgba(204, 204, 204, 1);
--gray-242: rgba(242, 242, 242, 1);
--gray-245: rgba(245, 245, 245, 1);
--gray-248: rgba(248, 248, 248, 1);
--blue-deep: rgba(0, 90, 158, 1);
--blue-deep-20pct: rgba(0, 90, 158, 0.2);
--blue-light: rgba(97, 218, 251, 1);
--blue-ultra-light: rgba(250, 252, 255, 1);
--blue-medium: rgba(0, 120, 212, 1);
--blue-medium-10pct: rgba(0, 120, 212, 0.1);
--blue-sky-50pct: rgba(47, 136, 255, 0.5);
--blue-navy: rgba(11, 52, 110, 1);
--white: rgba(255, 255, 255, 1);
--terre-primary: rgba(0, 92, 175, 1);
--terre-primary-5pct: rgba(0, 92, 175, 0.05);
--terre-primary-10pct: rgba(0, 92, 175, 0.1);
--addSentence-sentenceTypeButton-background: var(--black-5pct);
--addSentence-sentenceTypeButton-hover-background: var(--black-0pct);
--app-header-background: var(--gray-dark);
--app-header: var(--white);
--app-link: var(--blue-light);
--assets-controlCommonButton-border: var(--black-15pct);
--assets-controlCommonButton-hover-border: var(--terre-primary-10pct);
--assets-commonFileButton-hover-background: var(--black-5pct);
--assets-controlDirnameDisplay-border: var(--black-15pct);
--assets-deleteButton-hover-background: var(--black-10pct);
--assets-extNameShow-background: var(--blue-medium-10pct);
--assets-extNameShow: var(--blue-medium);
--assets-fileSelectButton-background: var(--blue-medium);
--assets-fileSelectButton: var(--white);
--assets-fileSelectButton-hover-background: var(--blue-deep);
--assets-fileSelectInput-border: var(--blue-medium);
--assets-fileSelectInput-focus-border: var(--blue-deep);
--assets-fileSelectInput-focus-box-shadow: var(--blue-deep-20pct);
--chooseFile-button-border-bottom: var(--black-10pct);
--commonTips-tips-background: var(--terre-primary-10pct);
--common-tag_title_button: var(--black-10pct);
--common-tag_title_button-first-child-border-left: var(--black-0pct);
--common-tag_title_button-hover-background: var(--black-10pct);
--common-tag_title_button-hover-border-left: var(--black-0pct);
--commonOption-item-hover-background: var(--black-5pct);
--commonOption-title: var(--black-50pct);
--createGameButton: var(--white);
--dashboard-gameElement-main-border: var(--black-15pct);
--dashboard-gameElement-main: var(--blue-navy);
--dashboard-gameElement-main-hover-background: var(--gray-245);
--dashboard-topBar-border-bottom: var(--black-10pct);
--editArea-none-text: var(--black-35pct);
--editorSidebar-control-button-active-background: var(--black-10pct);
--editorSidebar-divider-background: var(--black-10pct);
--editorSidebar-livePreviewNotice-background: var(--terre-primary-5pct);
--gameElement-box-shadow: var(--black-10pct);
--gamePreview-editGameButton: var(--white);
--gamePreview-noneChecked: var(--black-75pct);
--graphicalEditor-sentenceEditorWrapper-background: var(--white);
--graphicalEditor-sentenceEditorWrapper-border-bottom: var(--black-10pct);
--graphicalEditor-sentenceEditorWrapper: var(--black-50pct);
--graphicalEditor-lineNumber: var(--black-50pct);
--graphicalEditor-optionButton-hover-background: var(--black-5pct);
--iconPark-closeIcon-fill: var(--black);
--iconPark-icon-chooseFile-fill: var(--blue-sky-50pct);
--iconPark-icon-chooseFile-stroke-first: var(--gray-51);
--iconPark-icon-chooseFile-stroke-second: var(--white);
--iconPark-icon-chooseFile-stroke-third: var(--white);
--iconPark-icon-fill: var(--gray-51);
--sentenceEditor-sayArea: var(--black);
--sentenceEditor-sayArea-background: var(--black-5pct);
--sentenceEditor-sayArea-border: var(--black-7pct);
--sentenceEditor-sayInput-background: var(--black-5pct);
--sentenceEditor-sayInput-border: var(--black-7pct);
--sidebar-main-border-right: var(--black-10pct);
--sidebarComponents-fileElement-hover-background: var(--black-5pct);
--sidebarComponents-fileElement-interactable-icon-hover-background: var(--black-10pct);
--sideBarIcon-pressDown: var(--blue-navy);
--sideBarIcon-pressUp: var(--gray-102);
--sidebarTags-editButton-background: var(--terre-primary-10pct);
--sidebarTags-imageChooseItem-hover-background: var(--black-10pct);
--sidebarTags-open-assets-background: var(--terre-primary-10pct);
--sidebarTags-open-assets: var(--blue-navy);
--singleMessage-background: var(--blue-ultra-light);
--singleMessage: var(--blue-navy);
--singleMessage-border: var(--black-10pct);
--singleMessage-box-shadow: var(--black-10pct);
--tagManager-tag-background: var(--gray-248);
--tagManager-tag-border-top: var(--black-0pct);
--tagManager-tagsContainer-background: var(--gray-248);
--tagManager-tagsContainer-webkit-scrollbar-background: var(--gray-242);
--tagManager-tagsContainer-webkit-scrollbar-thumb-background: var(--gray-204);
--tagManager-tagsContainer-webkit-scrollbar-thumb-hover-background: var(--gray-153);
--tagManager-tagsContainer-Firefox-scrollbar-first: var(--gray-204);
--tagManager-tagsContainer-Firefox-scrollbar-second: var(--gray-242);
--tagManager-tag-active-background: var(--white);
--tagManager-tag-active-border-top: var(--blue-navy);
--tagManager-tag-hover-background: var(--black-10pct);
--tagManager-closeIcon-hover-background: var(--black-10pct);
--topbar-border-bottom: var(--black-10pct);
--topbar-editingGame-background: var(--terre-primary-10pct);
--topbar-home-btn-hover-background: var(--black-7pct);
}
2 changes: 0 additions & 2 deletions packages/origine2/src/config/themes/white.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
"activityBarBadge.background": "#54a3ff",
"sideBar.foreground": "#586069",
"sideBar.border": "#e1e4e8",
"sideBarIcon.pressDown": "#0B346E",
"sideBarIcon.pressUp": "#666",
"sideBarTitle.foreground": "#24292e",
"sideBarSectionHeader.background": "#F1F2F3",
"sideBarSectionHeader.foreground": "#24292e",
Expand Down
82 changes: 82 additions & 0 deletions packages/origine2/src/hooks/useHashRoute.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import {useDispatch, useSelector} from "react-redux";
import {RootState} from "@/store/origineStore";
import {useEffect} from "react";
import {setDashboardShow, setEditingGame, statusActions} from "@/store/statusReducer";
import {ITag} from "@/store/statusReducer";

export function useHashRoute() {
const state = useSelector((state: RootState) => state.status);
const isShowDashboard = state.dashboard.showDashBoard;
const editingGameName = state.editor.currentEditingGame;
const currentTag = state.editor.selectedTagTarget;
const dispatch = useDispatch();
useEffect(() => {
setTimeout(() => {
// 写入 Hash
// 如果显示 dashboard 或者两个状态都为空,则清空哈希
if (isShowDashboard || (!editingGameName && !currentTag)) {
window.location.hash = '';
return;
}
console.log(currentTag);
const tagInfoObj = state.editor.tags.find(e => e.tagTarget === currentTag);
let tagStr = '';
if (tagInfoObj) {
tagStr = JSON.stringify(tagInfoObj);
}
tagStr = encodeURIComponent(tagStr);
// 基于当前的状态构造哈希字符串,过滤掉空字符串并用 '/' 连接
const hashParts = [editingGameName, tagStr].filter(part => part !== '');
// 更新浏览器的哈希部分
window.location.hash = `#/${hashParts.join('/')}`;
}, 50);

}, [isShowDashboard, editingGameName, currentTag]);

useEffect(() => {
const result = decodeHash();
if (result.editingGameName !== '') {
dispatch(setDashboardShow(false));
dispatch(setEditingGame(result.editingGameName));
if (result.currentTag !== '') {
const currentTagJsonStr = decodeURIComponent(result.currentTag);
let tagObj: null | ITag = null;
try {
tagObj = JSON.parse(currentTagJsonStr);
} catch (e) {
}
if (tagObj) {
dispatch(statusActions.addEditAreaTag(tagObj));
dispatch(statusActions.setCurrentTagTarget(tagObj.tagTarget));
}

}
}
}, []);

}

function decodeHash() {
// 获取当前 URL 的哈希部分
const hash = window.location.hash;

// 如果没有哈希,返回空
if (!hash) {
return {editingGameName: '', currentTag: ''};
}

// 移除哈希开头的 #/ ,然后分割字符串
const parts = hash.slice(2).split('/');

// 根据 parts 的长度返回相应的值
if (parts.length === 0) {
// 哈希存在但没有内容
return {editingGameName: '', currentTag: ''};
} else if (parts.length === 1) {
// 只有 editingGameName
return {editingGameName: parts[0], currentTag: ''};
} else {
// 有 editingGameName 和 currentTag
return {editingGameName: parts[0], currentTag: parts[1]};
}
}
Loading

0 comments on commit 4663e0e

Please sign in to comment.