Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
94bc285
fix: stretch content's container in OperationCard
Handiwork Jul 2, 2024
fcbf917
Merge pull request #319 from Handiwork/dev
guansss Jul 5, 2024
1525800
temp storage
Jul 9, 2024
c3f92e5
chore: update generated assets [skip ci]
GalvinGao Jul 9, 2024
70470a4
Merge pull request #320 from MaaAssistantArknights/scripts/update
GalvinGao Jul 9, 2024
907af4a
temp storage
Jul 11, 2024
4b97b99
temp storage
Jul 11, 2024
2bfbfba
Merge pull request #3 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 11, 2024
faf0685
perf: operatoritem refactor
Jul 12, 2024
8bc80ac
feat: operator item completed
Jul 12, 2024
03bd8d6
Merge pull request #4 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 12, 2024
0f88b39
temp storage
Jul 15, 2024
8ca11b7
temp storage
Jul 15, 2024
6d491c2
Merge pull request #5 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 16, 2024
3638045
temp storage
Jul 16, 2024
c4c04aa
perf: code of filter by prof completed
Jul 16, 2024
d43af68
fix: bug fixed!
Jul 16, 2024
b621f6d
perf: part of pagination refacted
Jul 16, 2024
1121264
Merge pull request #6 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 16, 2024
6b989d2
perf: dataTotal about optimized
Jul 16, 2024
0ed2e80
chore: update generated assets [skip ci]
GalvinGao Jul 16, 2024
e5f5527
temp storage
Jul 17, 2024
3b42d77
perf: filter about refacted
Jul 17, 2024
e5ae8a1
fix: emergency bug fixed
Jul 17, 2024
b0b40e9
temp storga
Jul 17, 2024
eab9eb5
Merge pull request #7 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 17, 2024
798adad
mutiple select completed
Jul 17, 2024
ec589d6
feat: back to top button completed!
Jul 17, 2024
56a350d
temp storage
Jul 17, 2024
8557c1a
feat: back to top button completed!
Jul 18, 2024
6e34afd
feat: rarity select ready
Jul 18, 2024
28c46fa
temp storage
Jul 18, 2024
28a4c79
Merge pull request #8 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 18, 2024
ad21b50
temp storage
Jul 19, 2024
ea0b251
temp storage
Jul 19, 2024
8bd95e3
fix: some bugs in group fixed
Jul 22, 2024
9df7256
temp storage
Jul 22, 2024
4ef590d
Merge pull request #9 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 22, 2024
b71c847
temp storage
Jul 23, 2024
5d1c634
Merge pull request #10 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 23, 2024
e3cd8f5
feat: ui of operator selector completed
Jul 23, 2024
7c68c1e
temp storage
Jul 24, 2024
77dc64f
Merge pull request #11 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 24, 2024
eb233f9
Revert "temp storage"
GeorgeZhang2035 Jul 26, 2024
82b1fb1
Merge pull request #12 from GeorgeZhang2035/revert-11-perf/sheet
Gemini2035 Jul 26, 2024
240d78f
Revert "Revert "temp storage""
Gemini2035 Jul 26, 2024
cc16c41
Merge pull request #13 from Gemini2035/revert-12-revert-11-perf/sheet
Gemini2035 Jul 26, 2024
106e5dc
feat: onSubmit ready
Jul 26, 2024
e814442
temp storage
Jul 26, 2024
59a0861
fix(accountmenu): update nav bar display
martinwang2002 Jul 26, 2024
1955168
Merge pull request #14 from GeorgeZhang2035/perf/sheet
Gemini2035 Jul 26, 2024
847c116
feat: func ready
Jul 26, 2024
faba50e
lint-fix: make eslint happy
Handiwork Jul 27, 2024
6b194c8
perf: code about sheet refactor
Jul 27, 2024
e86aeb1
code about sheet refacted
Jul 27, 2024
ca1994e
fix: prof image 404 fixed
Jul 27, 2024
089d017
chore: update generated assets [skip ci]
GalvinGao Aug 1, 2024
7344538
Merge pull request #324 from MaaAssistantArknights/scripts/update
GalvinGao Aug 1, 2024
b4a125d
Merge pull request #323 from Gemini2035/perf/sheetAbout
guansss Aug 4, 2024
83972fb
chore: update generated assets [skip ci]
GalvinGao Aug 5, 2024
1ee4093
Merge pull request #325 from MaaAssistantArknights/scripts/update
GalvinGao Aug 6, 2024
58b97af
build: update assets on main
GalvinGao Aug 6, 2024
56caac5
chore: update typescript
GalvinGao Aug 6, 2024
b923eb0
Revert "build: update assets on main"
guansss Aug 9, 2024
ee9ce82
chore: update generated assets [skip ci]
GalvinGao Sep 2, 2024
0943482
Merge pull request #334 from MaaAssistantArknights/scripts/update
GalvinGao Sep 3, 2024
00f1b22
feat: pages index sticky
fundgao Sep 4, 2024
7deab45
Merge pull request #337 from fundgao/dev
Handiwork Sep 4, 2024
af646b4
feat: 添加支持作者评论字数上限为500
dragove Sep 5, 2024
bd573d6
refactor: default max length for comment form
guansss Sep 5, 2024
b285b61
Merge pull request #338 from dragove/dev
guansss Sep 5, 2024
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
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[*.{js,ts,jsx,tsx,css,json,md,mdx,yml,yaml}]
indent_size = 2
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"pinyin": "^3.0.0-alpha.5",
"simplebig": "^0.0.3",
"tailwindcss": "^3.1.4",
"typescript": "^5.3.3",
"typescript": "^5.5.0",
"vite": "^4.2.1"
},
"resolutions": {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/operator-avatars/char_4147_mitm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions scripts/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export async function getOperators() {
return [
{
id: id,
prof: op.profession,
subProf: op.subProfessionId,
...transformOperatorName(op.name),
rarity:
Expand Down
11 changes: 10 additions & 1 deletion src/components/AccountManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const AccountMenu: FC = () => {
const [authState, setAuthState] = useAtom(authAtom)
const [logoutDialogOpen, setLogoutDialogOpen] = useState(false)
const [editDialogOpen, setEditDialogOpen] = useState(false)
const { isSM } = useCurrentSize()

const handleLogout = () => {
setAuthState({})
Expand Down Expand Up @@ -72,6 +73,14 @@ const AccountMenu: FC = () => {
/>
)}

{isSM && (
<MenuItem
shouldDismissPopover={false}
icon="user"
text={authState.username}
/>
)}

<MenuItem
shouldDismissPopover={false}
icon="edit"
Expand Down Expand Up @@ -161,7 +170,7 @@ export const AccountManager: ComponentType = withGlobalErrorBoundary(() => {
<Popover2 content={<AccountMenu />} position={Position.BOTTOM_RIGHT}>
<Button
icon="user"
text={authState.username}
text={!isSM && authState.username}
rightIcon="caret-down"
/>
</Popover2>
Expand Down
8 changes: 6 additions & 2 deletions src/components/FactItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ export const FactItem: FCC<{
className,
)}
>
{icon && <Icon icon={icon} className="mr-2 text-zinc-500 dark:text-slate-100" />}
<div className="text-sm mr-2 text-zinc-500 dark:text-slate-100">{title}</div>
{icon && (
<Icon icon={icon} className="mr-2 text-zinc-500 dark:text-slate-100" />
)}
<div className="text-sm mr-2 text-zinc-500 dark:text-slate-100">
{title}
</div>
{children}
</div>
)
7 changes: 6 additions & 1 deletion src/components/HelperText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ export const HelperText: FCC<{
}

return (
<div className={clsx('flex text-gray-600 dark:text-zinc-400 text-xs items-center', className)}>
<div
className={clsx(
'flex text-gray-600 dark:text-zinc-400 text-xs items-center',
className,
)}
>
<Icon icon="info-sign" size={12} className="mr-1.5" />
<div>{child()}</div>
</div>
Expand Down
11 changes: 5 additions & 6 deletions src/components/OperationCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ export const NeoOperationCard = ({ operation }: { operation: Operation }) => {
const { data: levels } = useLevels()

return (
<Card
interactive={true}
elevation={Elevation.TWO}
className="relative flex flex-col gap-2"
>
<ReLink search={{ op: operation.id }} className="block no-underline">
<Card interactive={true} elevation={Elevation.TWO} className="relative">
<ReLink
search={{ op: operation.id }}
className="no-underline h-full flex flex-col gap-2"
>
<div className="flex">
<Tooltip2
content={operation.parsedContent.doc.title}
Expand Down
6 changes: 2 additions & 4 deletions src/components/Paragraphs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const Paragraphs: FC<{
const { height } = paragraphElementRef.current.getBoundingClientRect()

setExceededLimitHeight(height > limitHeight)
}, [paragraphElementRef.current, limitHeight])
}, [limitHeight])

const mask = exceededLimitHeight
? 'linear-gradient(to bottom, rgba(0,0,0,1) 0%, rgba(0,0,0,1) calc(100% - 2rem), rgba(0,0,0,0) 100%)'
Expand All @@ -40,9 +40,7 @@ export const Paragraphs: FC<{
}}
>
<div ref={paragraphElementRef}>
{paragraphs?.map((paragraph, index) => (
<p key={index}>{paragraph}</p>
))}
{paragraphs?.map((paragraph, index) => <p key={index}>{paragraph}</p>)}
</div>
</div>
)
Expand Down
1 change: 1 addition & 0 deletions src/components/Suspensable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const Suspensable: FCC<SuspensableProps> = ({
useEffect(() => {
resetError.current?.()
resetError.current = undefined
// eslint-disable-next-line react-hooks/exhaustive-deps
}, retryDeps)

return (
Expand Down
8 changes: 4 additions & 4 deletions src/components/ThemeSwitchButton.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { Button } from '@blueprintjs/core'

import { useEffect, useState } from 'react'
import { useCallback, useEffect, useState } from 'react'

const themeMedia = window.matchMedia('(prefers-color-scheme: light)')

export const ThemeSwitchButton = () => {
const [theme, setTheme] = useState(localStorage.getItem('theme') || '')
const handleThemeSwitch = () => {
const handleThemeSwitch = useCallback(() => {
const isCurrentDark = theme === 'dark'
setTheme(isCurrentDark ? 'light' : 'dark')
localStorage.setItem('theme', isCurrentDark ? 'light' : 'dark')
}
}, [theme])
useEffect(() => {
if (!themeMedia.matches && !localStorage.getItem('theme')) {
handleThemeSwitch()
Expand All @@ -23,7 +23,7 @@ export const ThemeSwitchButton = () => {
document.body.classList.remove('bp4-dark')
document.body.classList.remove('dark')
}
}, [theme])
}, [theme, handleThemeSwitch])
return (
<Button
onClick={handleThemeSwitch}
Expand Down
2 changes: 1 addition & 1 deletion src/components/account/EditDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const InfoPanel = ({ onClose }) => {

useEffect(() => {
reset(auth)
}, [auth])
}, [auth, reset])

const globalError = (errors as FieldErrors<{ global: void }>).global?.message

Expand Down
8 changes: 4 additions & 4 deletions src/components/announcement/AnnPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const AnnPanel: FC<AnnPanelProps> = ({ className }) => {
setDisplaySections(freshSections)
setLastNoticed(Date.now())
}
}, [announcement])
}, [announcement, lastNoticed, setLastNoticed])

return (
<>
Expand All @@ -60,9 +60,9 @@ export const AnnPanel: FC<AnnPanelProps> = ({ className }) => {
<div className="flex">
{announcement && (
<ul className="grow list-disc pl-4">
{announcement?.sections.slice(0, 3).map(({ title }) => (
<li key={title}>{title}</li>
))}
{announcement?.sections
.slice(0, 3)
.map(({ title }) => <li key={title}>{title}</li>)}
</ul>
)}
{!announcement && error && (
Expand Down
6 changes: 2 additions & 4 deletions src/components/editor/EditorFieldProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,8 @@ type PathOfType<T, P extends Path<T> | ArrayPath<T>, U> = P extends any
* }
* ```
*/
export interface EditorFieldProps<
TFieldValues extends FieldValues,
TType = any,
> extends UseControllerProps<
export interface EditorFieldProps<TFieldValues extends FieldValues, TType = any>
extends UseControllerProps<
TFieldValues,
// the Cast here is a workaround for the fact that TS cannot correctly recognize
// that the result of PathOfType is assignable to FieldPath<TFieldValues>
Expand Down
1 change: 1 addition & 0 deletions src/components/editor/NumericInput2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
NumericInput,
NumericInputProps,
} from '@blueprintjs/core'

import { useRef, useState } from 'react'

type MixedNumericInputProps = HTMLInputProps & NumericInputProps
Expand Down
2 changes: 1 addition & 1 deletion src/components/editor/OperationEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export const OperationEditor: FC<OperationEditorProps> = ({
)
}
}
}, [stageName, levels])
}, [stageName, levels, getValues, setValue])

const globalError = (errors as FieldErrors<{ global: void }>).global?.message

Expand Down
21 changes: 12 additions & 9 deletions src/components/editor/action/EditorActionAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,15 @@ export const EditorActionAdd = ({
[levels, stageName],
)

const resettingValues: DeepPartial<CopilotDocV1.Action> = {
...defaultAction,
// to prevent layout jumping, we persist the action type on reset
type,
...(type === 'MoveCamera' ? defaultMoveCameraAction : null),
}
const resettingValues: DeepPartial<CopilotDocV1.Action> = useMemo(
() => ({
...defaultAction,
// to prevent layout jumping, we persist the action type on reset
type,
...(type === 'MoveCamera' ? defaultMoveCameraAction : null),
}),
[type],
)

useEffect(() => {
if (editingAction) {
Expand Down Expand Up @@ -154,13 +157,13 @@ export const EditorActionAdd = ({
} else {
reset(resettingValues)
}
}, [editingAction])
}, [editingAction, reset, resettingValues, setValue])

useEffect(() => {
if (type === 'MoveCamera') {
reset(resettingValues)
}
}, [type])
}, [type, reset, resettingValues])

useEffect(() => {
setValue(
Expand All @@ -169,7 +172,7 @@ export const EditorActionAdd = ({
? (editingAction as CopilotDocV1.ActionSkillUsage)?.skillTimes ?? 1
: undefined,
)
}, [skillUsage])
}, [skillUsage, editingAction, setValue])

const onSubmit = handleSubmit((values) => {
if ('name' in values) {
Expand Down
8 changes: 4 additions & 4 deletions src/components/editor/floatingMap/FloatingMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function FloatingMap() {
x: clamp(cfg.x, 0, windowWidth - cfg.width),
y: clamp(cfg.y, 0, windowHeight - cfg.height),
}))
}, [windowWidth, windowHeight])
}, [setConfig, windowWidth, windowHeight])

const [iframeWindow, setIframeWindow] = useState<Window | null | undefined>()
const [mapStatus, setMapStatus] = useState(MapStatus.Loading)
Expand All @@ -81,7 +81,7 @@ export function FloatingMap() {
// when level changes, the iframe should reload
setMapStatus(MapStatus.Loading)
setConfig((cfg) => ({ ...cfg, level }))
}, [level])
}, [setConfig, level])

const setMapState = useCallback(() => {
if (iframeWindow) {
Expand Down Expand Up @@ -136,7 +136,7 @@ export function FloatingMap() {
toggleIframePointerEvents(false)
setConfig((cfg) => ({ ...cfg, x, y }))
},
[toggleIframePointerEvents],
[setConfig, toggleIframePointerEvents],
)

const onResizeStartHandler = useCallback(() => {
Expand All @@ -153,7 +153,7 @@ export function FloatingMap() {
height: parseFloat(ref.style.height),
}))
},
[toggleIframePointerEvents],
[setConfig, toggleIframePointerEvents],
)

return createPortal(
Expand Down
2 changes: 1 addition & 1 deletion src/components/editor/operator/EditorOperator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CopilotDocV1 } from '../../../models/copilot.schema'
import { OPERATORS } from '../../../models/operator'
import { Suggest } from '../../Suggest'

type OperatorInfo = typeof OPERATORS[number]
type OperatorInfo = (typeof OPERATORS)[number]
type PerformerItem = OperatorInfo | CopilotDocV1.Group

const isOperator = (item: PerformerItem): item is OperatorInfo =>
Expand Down
18 changes: 9 additions & 9 deletions src/components/editor/operator/EditorPerformer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,6 @@ export const EditorPerformer: FC<EditorPerformerProps> = ({ control }) => {
setError,
fromSheet,
) => {
const removeOperatorByArray = () =>
removeOperator(
group.opers
?.map((item) => operators.findIndex(({ name }) => name === item.name))
.filter((item) => item !== -1),
)

if (
groups.find(({ name, _id }) => name === group.name && _id !== group._id)
) {
Expand All @@ -331,7 +324,6 @@ export const EditorPerformer: FC<EditorPerformerProps> = ({ control }) => {
: findGroupById(getId(editingGroup!))
if (existingGroup) {
group._id = getId(existingGroup)
if (fromSheet) removeOperatorByArray()
updateGroup(
groups.findIndex(({ _id }) => _id === existingGroup._id),
group,
Expand All @@ -344,7 +336,15 @@ export const EditorPerformer: FC<EditorPerformerProps> = ({ control }) => {
} else {
group._id = uniqueId()
appendGroup(group)
if (group.opers?.length) removeOperatorByArray()
if (group.opers?.length) {
removeOperator(
group.opers
?.map((item) =>
operators.findIndex(({ name }) => name === item.name),
)
.filter((item) => item !== -1),
)
}
}

return true
Expand Down
Loading
Loading