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

[Feature] 剧情编辑器有考虑做吗 #153

Open
4 of 5 tasks
notnotype opened this issue Sep 6, 2023 · 1 comment
Open
4 of 5 tasks

[Feature] 剧情编辑器有考虑做吗 #153

notnotype opened this issue Sep 6, 2023 · 1 comment
Labels
module: story-editor 剧情编辑器的问题 module: story-player 播放器的问题 sweep Assigns Sweep to an issue or pull request. UI

Comments

@notnotype
Copy link
Contributor

notnotype commented Sep 6, 2023

Details

No response

Checklist
  • apps/blue-archive-story-editor/src/views/StoryEditor.vue

• Create a new Vue component for the story editor view. This component should include a text editor for writing the story and a sidebar for selecting story units.
• Add methods for saving and retrieving stories using the ApiServiceAdapter.

  • apps/blue-archive-story-editor/src/interface/http.ts

• Add new methods to the ApiServiceAdapter interface for saving and retrieving stories.
• Implement these methods in the ApiServiceAdapter implementation.

  • apps/blue-archive-story-editor/src/views/Editor/tools/storyUnitMap.ts

• Add new types of story units to the StoryRawUnitGeneratorMap.
• Implement the raw and internal methods for these new types of story units.

  • lib/ba-story-player/lib/layers/uiLayer/components/BaPlayerSetting/slider/utils/locale/lang/en.ts

• Add new entries to the localization file for the story editor and the new types of story units.

  • apps/blue-archive-story-editor/src/router/index.ts

• Add a new route for the story editor view.

@notnotype notnotype added the sweep Assigns Sweep to an issue or pull request. label Sep 6, 2023
@github-actions github-actions bot added the module: story-editor 剧情编辑器的问题 label Sep 6, 2023
@sweep-ai
Copy link
Contributor

sweep-ai bot commented Sep 6, 2023

Here's the PR! #154.

⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 4 GPT-4 tickets left for the month and 1 for the day. For more GPT-4 tickets, visit our payment portal. To retrigger Sweep, edit the issue.


Step 1: 🔍 Code Search

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.

import { AxiosError, AxiosPromise, AxiosRequestConfig, AxiosResponse } from "axios";
import { instanceObject } from "@/utils/format";
import { ActualBaseExcelTable, ExcelTable, ExcelTableType } from "@/types";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface IRequestConfig<D = any> extends AxiosRequestConfig<D> {
// 当网络请求错误时是否显示错误
showResponseError?: boolean;
// 当http 200但是 serverResponse.code !== 200 时是否显示 serverResponse.message
// 默认开启
showServerResponseError?: boolean;
// 返回值是否是文件流
isBlob?: boolean;
}
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface IResponseError<T = any, D = any> extends AxiosError<T, D> {
config: IRequestConfig<D>;
}
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface IResponse<T = any, D = any> extends AxiosResponse<T, D> {
config: IRequestConfig<D>;
}
// export type ServerResponse<T> = {
// code: number;
// message: string;
// data: T;
// };
export type ServerResponse<T> = T;
export interface ApiServiceAdapter {
upload(url: string, file: FormData | File): Promise<ServerResponse<string>>;
download(id: string): AxiosPromise;
raw<T>(config: IRequestConfig): Promise<ServerResponse<T>>;
excel<T extends ExcelTableType>(
type: T,
): Promise<ServerResponse<ExcelTable<NonNullable<ReturnType<ActualBaseExcelTable[T]["get"]>>>>>;
urlDownload(url: string, data: instanceObject): void;
}
export const NetworkAdapter = {
Offline: "离线",
Localhost: "本地连接",
Proxy: "代理",
};

export default {
name: "en",
el: {
colorpicker: {
confirm: "OK",
clear: "Clear",
defaultLabel: "color picker",
description:
"current color is {color}. press enter to select a new color.",
},
datepicker: {
now: "Now",
today: "Today",
cancel: "Cancel",
clear: "Clear",
confirm: "OK",
dateTablePrompt:
"Use the arrow keys and enter to select the day of the month",
monthTablePrompt: "Use the arrow keys and enter to select the month",
yearTablePrompt: "Use the arrow keys and enter to select the year",
selectedDate: "Selected date",
selectDate: "Select date",
selectTime: "Select time",
startDate: "Start Date",
startTime: "Start Time",
endDate: "End Date",
endTime: "End Time",
prevYear: "Previous Year",
nextYear: "Next Year",
prevMonth: "Previous Month",
nextMonth: "Next Month",
year: "",
month1: "January",
month2: "February",
month3: "March",
month4: "April",
month5: "May",
month6: "June",
month7: "July",
month8: "August",
month9: "September",
month10: "October",
month11: "November",
month12: "December",
week: "week",
weeks: {
sun: "Sun",
mon: "Mon",
tue: "Tue",
wed: "Wed",
thu: "Thu",
fri: "Fri",
sat: "Sat",
},
weeksFull: {
sun: "Sunday",
mon: "Monday",
tue: "Tuesday",
wed: "Wednesday",
thu: "Thursday",
fri: "Friday",
sat: "Saturday",
},
months: {
jan: "Jan",
feb: "Feb",
mar: "Mar",
apr: "Apr",
may: "May",
jun: "Jun",
jul: "Jul",
aug: "Aug",
sep: "Sep",
oct: "Oct",
nov: "Nov",
dec: "Dec",
},
},
inputNumber: {
decrease: "decrease number",
increase: "increase number",
},
select: {
loading: "Loading",
noMatch: "No matching data",
noData: "No data",
placeholder: "Select",
},
dropdown: {
toggleDropdown: "Toggle Dropdown",
},
cascader: {
noMatch: "No matching data",
loading: "Loading",
placeholder: "Select",
noData: "No data",
},
pagination: {
goto: "Go to",
pagesize: "/page",
total: "Total {total}",
pageClassifier: "",
page: "Page",
prev: "Go to previous page",
next: "Go to next page",
currentPage: "page {pager}",
prevPages: "Previous {pager} pages",
nextPages: "Next {pager} pages",
deprecationWarning:
"Deprecated usages detected, please refer to the el-pagination documentation for more details",
},
dialog: {
close: "Close this dialog",
},
drawer: {
close: "Close this dialog",
},
messagebox: {
title: "Message",
confirm: "OK",
cancel: "Cancel",
error: "Illegal input",
close: "Close this dialog",
},
upload: {
deleteTip: "press delete to remove",
delete: "Delete",
preview: "Preview",
continue: "Continue",
},
slider: {
defaultLabel: "slider between {min} and {max}",
defaultRangeStartLabel: "pick start value",
defaultRangeEndLabel: "pick end value",
},
table: {
emptyText: "No Data",
confirmFilter: "Confirm",
resetFilter: "Reset",
clearFilter: "All",
sumText: "Sum",
},
tree: {
emptyText: "No Data",
},
transfer: {
noMatch: "No matching data",
noData: "No data",
titles: ["List 1", "List 2"], // to be translated
filterPlaceholder: "Enter keyword", // to be translated
noCheckedFormat: "{total} items", // to be translated
hasCheckedFormat: "{checked}/{total} checked", // to be translated
},
image: {
error: "FAILED",
},
pageHeader: {
title: "Back", // to be translated
},
popconfirm: {
confirmButtonText: "Yes",
cancelButtonText: "No",
},
},

https://github.com/ba-archive/blue-archive/blob/d5ddc0fdfd2f2ac4f6da77371410c504ef198d04/common/config/rush/pnpm-config.json#L355-L203

},
option: {
component: defineAsyncComponent(() => import("../StoryItems/TitleUnit.vue")),
type: "option",
icon: "",
title: "",
description: "",
},
st: {
component: defineAsyncComponent(() => import("../StoryItems/TitleUnit.vue")),
type: "st",
icon: "",
title: "",
description: "",
},
effectOnly: {
component: defineAsyncComponent(() => import("../StoryItems/EffectUnit.vue")),
type: "effectOnly",
icon: "",
title: "特效层",
description: "背景啥的",
},
continue: {
component: defineAsyncComponent(() => import("../StoryItems/TitleUnit.vue")),
type: "continue",
icon: "",
title: "",
description: "",
},
nextEpisode: {
component: defineAsyncComponent(() => import("../StoryItems/TitleUnit.vue")),
type: "nextEpisode",
icon: "",
title: "",
description: "",
},
};
/**
* <h1>重点修改</h1>
*
* 在这里面添加生成函数
*/
// @ts-ignore
export const StoryRawUnitGeneratorMap: IStoryUnitGenerator = {
title: {
raw: {
ScriptKr(title: Ref<string>, subTitle: Ref<string | undefined>) {
return `#title;${this.TextCn(title, subTitle)}`;
},
TextCn(title: Ref<string>, subTitle: Ref<string | undefined>) {
const base = `${title.value}`;
if (subTitle.value) {
return `${subTitle.value};${base}`;
}
return base;
},
},
internal(title: Ref<string>, subTitle: Ref<string | undefined>) {
return {
type: "title",
title: title.value,
subTitle: subTitle.value,
};
},
default() {
return {
type: "title",
title: "",
subTitle: "",
};
},
},
place: {
raw: {
ScriptKr(place: Ref<string>) {
return `#place;${this.TextCn(place)}`;
},
TextCn(place: Ref<string>) {

https://github.com/ba-archive/blue-archive/blob/d5ddc0fdfd2f2ac4f6da77371410c504ef198d04/lib/ba-story-player/docs/contribute.md#L85-L67


Step 2: 🧐 Snippet Analysis

From looking through the relevant snippets, I decided to make the following modifications:

File Path Proposed Changes
apps/blue-archive-story-editor/src/views/StoryEditor.vue Create apps/blue-archive-story-editor/src/views/StoryEditor.vue with contents:
• Create a new Vue component for the story editor view. This component should include a text editor for writing the story and a sidebar for selecting story units.
• Add methods for saving and retrieving stories using the ApiServiceAdapter.
apps/blue-archive-story-editor/src/interface/http.ts Modify apps/blue-archive-story-editor/src/interface/http.ts with contents:
• Add new methods to the ApiServiceAdapter interface for saving and retrieving stories.
• Implement these methods in the ApiServiceAdapter implementation.
apps/blue-archive-story-editor/src/views/Editor/tools/storyUnitMap.ts Modify apps/blue-archive-story-editor/src/views/Editor/tools/storyUnitMap.ts with contents:
• Add new types of story units to the StoryRawUnitGeneratorMap.
• Implement the raw and internal methods for these new types of story units.
lib/ba-story-player/lib/layers/uiLayer/components/BaPlayerSetting/slider/utils/locale/lang/en.ts Modify lib/ba-story-player/lib/layers/uiLayer/components/BaPlayerSetting/slider/utils/locale/lang/en.ts with contents:
• Add new entries to the localization file for the story editor and the new types of story units.
apps/blue-archive-story-editor/src/router/index.ts Modify apps/blue-archive-story-editor/src/router/index.ts with contents:
• Add a new route for the story editor view.

Step 3: 📝 Planning

I have created a plan for writing the pull request. I am now working my plan and coding the required changes to address this issue. Here is the planned pull request:

[Feature] Add Story Editor
sweep/story-editor

Description

This PR adds a new feature to the Blue Archive application: the Story Editor. The Story Editor allows users to create and edit stories for the game. It includes a text editor for writing the story and a sidebar for selecting different types of story units. The Story Editor also includes localization support for multiple languages.

Summary of Changes

  • Created a new Vue component for the Story Editor view (StoryEditor.vue).
  • Added methods to the ApiServiceAdapter interface for saving and retrieving stories.
  • Implemented the new methods in the ApiServiceAdapter implementation.
  • Added new types of story units to the StoryRawUnitGeneratorMap.
  • Implemented the raw and internal methods for the new types of story units.
  • Added new entries to the localization file (en.ts) for the Story Editor and the new types of story units.
  • Added a new route for the Story Editor view in the router configuration (index.ts).

Step 4: ⌨️ Coding

File Instructions Progress Error logs
apps/blue-archive-story-editor/src/views/StoryEditor.vue Create apps/blue-archive-story-editor/src/views/StoryEditor.vue with contents:
• Create a new Vue component for the story editor view. This component should include a text editor for writing the story and a sidebar for selecting story units.
• Add methods for saving and retrieving stories using the ApiServiceAdapter.
✅ Commit fe62150 No errors.
apps/blue-archive-story-editor/src/interface/http.ts Modify apps/blue-archive-story-editor/src/interface/http.ts with contents:
• Add new methods to the ApiServiceAdapter interface for saving and retrieving stories.
• Implement these methods in the ApiServiceAdapter implementation.
✅ Commit 730b3ef No errors.
apps/blue-archive-story-editor/src/views/Editor/tools/storyUnitMap.ts Modify apps/blue-archive-story-editor/src/views/Editor/tools/storyUnitMap.ts with contents:
• Add new types of story units to the StoryRawUnitGeneratorMap.
• Implement the raw and internal methods for these new types of story units.
❌ Failed
lib/ba-story-player/lib/layers/uiLayer/components/BaPlayerSetting/slider/utils/locale/lang/en.ts Modify lib/ba-story-player/lib/layers/uiLayer/components/BaPlayerSetting/slider/utils/locale/lang/en.ts with contents:
• Add new entries to the localization file for the story editor and the new types of story units.
✅ Commit e1b169d No errors.
apps/blue-archive-story-editor/src/router/index.ts Modify apps/blue-archive-story-editor/src/router/index.ts with contents:
• Add a new route for the story editor view.
✅ Commit e1b169d No errors.

Step 5: 🔁 Code Review

Here are my self-reviews of my changes at sweep/story-editor.

Here is the 1st review

Thank you for your contribution. Here are some changes that need to be made:

  • In apps/blue-archive-story-editor/src/interface/http.ts, the removal of the urlDownload function and the incomplete excel function could cause reference and syntax errors. Please ensure that these functions are not being used elsewhere in the code or complete the implementation of the excel function. Also, please add the closing bracket for the ApiServiceAdapter interface to avoid syntax errors.

  • In apps/blue-archive-story-editor/src/router/index.ts, please ensure that the '@/views/StoryEditor.vue' file exists and is properly exported to avoid errors when navigating to the '/story-editor' route.

  • In apps/blue-archive-story-editor/src/views/StoryEditor.vue, please ensure that the upload and download methods exist on ApiServiceAdapter to avoid errors.

  • In lib/ba-story-player/lib/layers/uiLayer/components/BaPlayerSetting/slider/utils/locale/lang/en.ts, please ensure that the new localization strings are used correctly in the rest of the code to avoid incorrect or missing text in the user interface.

Please make these changes and submit a new pull request. If you need any help, feel free to ask.

I finished incorporating these changes.


🎉 Latest improvements to Sweep:

  • Use Sweep Map to break large issues into smaller sub-issues, perfect for large tasks like "Sweep (map): migrate from React class components to function components"
  • Getting Sweep to format before committing! Check out Sweep Sandbox Configs to set it up.
  • We released a demo of our chunker, where you can find the corresponding blog and code.

💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request.
Join Our Discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: story-editor 剧情编辑器的问题 module: story-player 播放器的问题 sweep Assigns Sweep to an issue or pull request. UI
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

1 participant