Skip to content

Commit

Permalink
Merge pull request #216 from MaaAssistantArknights/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
GalvinGao authored Oct 9, 2023
2 parents 17f70d2 + 3655ebf commit 93bfb1a
Show file tree
Hide file tree
Showing 13 changed files with 105 additions and 21 deletions.
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.
6 changes: 5 additions & 1 deletion src/components/OperatorSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ export const OperatorSelect: FC<OperatorSelectProps> = ({
}

const add = (operation: OperatorInfo) => {
change([...new Set([...operators, { name: operation.name }])])
if (!operators.some((op) => op.name === operation.name)) {
change([...operators, { name: operation.name }])
} else {
remove(operation)
}
}

const remove = (operation: OperatorInfo) => {
Expand Down
30 changes: 16 additions & 14 deletions src/components/editor/action/EditorActionAdd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,20 +259,22 @@ export const EditorActionAdd = ({
<div className="h-px w-full bg-gray-200 mt-4 mb-6" />

<EditorActionModule
title="执行条件" icon="stopwatch" className="font-bold"
title="执行条件"
icon="stopwatch"
className="font-bold"
>
<div className="flex flex-wrap">
<EditorActionExecPredicateKills control={control} />
<EditorActionExecPredicateCooling control={control} />
</div>
<div className="flex flex-wrap">
<EditorActionExecPredicateCosts control={control} />
<EditorActionExecPredicateCostChange control={control} />
</div>
<div className="flex flex-wrap">
<EditorActionPreDelay control={control} />
<EditorActionRearDelay control={control} />
</div>
<div className="flex flex-wrap">
<EditorActionExecPredicateKills control={control} />
<EditorActionExecPredicateCooling control={control} />
</div>
<div className="flex flex-wrap">
<EditorActionExecPredicateCosts control={control} />
<EditorActionExecPredicateCostChange control={control} />
</div>
<div className="flex flex-wrap">
<EditorActionPreDelay control={control} />
<EditorActionRearDelay control={control} />
</div>
</EditorActionModule>
<div className="h-px w-full bg-gray-200 mt-4 mb-6" />

Expand Down Expand Up @@ -309,7 +311,7 @@ export const EditorActionAdd = ({
/>
</div>
</EditorActionModule>

<div className="mt-4 flex">
<Button intent="primary" type="submit" icon={isNew ? 'add' : 'edit'}>
{isNew ? '添加' : '保存'}
Expand Down
40 changes: 34 additions & 6 deletions src/components/viewer/OperationRating.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Icon, IconSize } from '@blueprintjs/core'
import { Popover2InteractionKind, Tooltip2 } from '@blueprintjs/popover2'

import clsx from 'clsx'
import { FC } from 'react'
Expand All @@ -7,8 +8,39 @@ import Rating from 'react-rating'
import { Operation } from 'models/operation'
import { ratingLevelToString } from 'models/rating'

type PickedOperation = Pick<
Operation,
'notEnoughRating' | 'ratingRatio' | 'ratingLevel' | 'like' | 'dislike'
>

const GetLevelDescription: FC<{
operation: PickedOperation
layout?: 'horizontal' | 'vertical'
}> = ({ operation, layout }) => {
return operation.notEnoughRating ? (
layout === 'vertical' ? (
<>还没有足够的评分</>
) : (
<>评分不足</>
)
) : (
<Tooltip2
className="!inline-block !mt-0"
interactionKind={Popover2InteractionKind.HOVER}
content={`有${Math.round(
(operation.like / (operation.like + operation.dislike)) * 100,
)}%的人为本作业点了个赞(${operation.like}/${
operation.like + operation.dislike
})`}
position="bottom-left"
>
{ratingLevelToString(operation.ratingLevel)}
</Tooltip2>
)
}

export const OperationRating: FC<{
operation: Pick<Operation, 'notEnoughRating' | 'ratingRatio' | 'ratingLevel'>
operation: PickedOperation
layout?: 'horizontal' | 'vertical'
className?: string
}> = ({ operation, layout = 'vertical', className }) => {
Expand Down Expand Up @@ -60,11 +92,7 @@ export const OperationRating: FC<{
layout === 'horizontal' && !operation.notEnoughRating && 'mr-1.5',
)}
>
{operation.notEnoughRating
? layout === 'vertical'
? '还没有足够的评分'
: '评分不足'
: ratingLevelToString(operation.ratingLevel)}
<GetLevelDescription layout={layout} operation={operation} />
</div>
</div>
)
Expand Down
48 changes: 48 additions & 0 deletions src/models/generated/operators.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@
"alias": "bianren br 鞭刃",
"alt_name": "Whislash"
},
{
"id": "char_4104_coldst",
"name": "冰酿",
"alias": "bingniang bn 冰釀",
"alt_name": "Coldshot"
},
{
"id": "char_258_podego",
"name": "波登可",
Expand Down Expand Up @@ -317,6 +323,12 @@
"alias": "chunjinaiyafala chunjinyiyafala cjayfl cjyyfl 純燼艾雅法拉",
"alt_name": "Eyjafjalla the Hvít Aska"
},
{
"id": "char_494_vendla",
"name": "刺玫",
"alias": "cimei cm 刺玫",
"alt_name": "Vendela"
},
{
"id": "token_10008_cqbw_box",
"name": "此面向敌",
Expand All @@ -341,6 +353,12 @@
"alias": "dageda dgd 達格達",
"alt_name": "Dagda"
},
{
"id": "char_4110_delphn",
"name": "戴菲恩",
"alias": "daifeien dfe 戴菲恩",
"alt_name": "Delphine"
},
{
"id": "char_4032_provs",
"name": "但书",
Expand All @@ -353,6 +371,12 @@
"alias": "dekesasi dkss 德克薩斯",
"alt_name": "Texas"
},
{
"id": "char_1034_jesca2",
"name": "涤火杰西卡",
"alias": "dihuojiexika dihuojiexiqia dhjxk dhjxq 滌火傑西卡",
"alt_name": "Jessica the Liberated"
},
{
"id": "char_183_skgoat",
"name": "地灵",
Expand Down Expand Up @@ -527,6 +551,12 @@
"alias": "haojiao haojue hj 號角",
"alt_name": "Horn"
},
{
"id": "char_4088_hodrer",
"name": "赫德雷",
"alias": "hedelei hdl 赫德雷",
"alt_name": "Hoederer"
},
{
"id": "char_4041_chnut",
"name": "褐果",
Expand Down Expand Up @@ -671,6 +701,12 @@
"alias": "jici jc 棘刺",
"alt_name": "Thorns"
},
{
"id": "token_10032_jesca2_jckshd",
"name": "机动盾牌",
"alias": "jidongdunpai jddp 機動盾牌",
"alt_name": "Mobile personnel shield"
},
{
"id": "char_422_aurora",
"name": "极光",
Expand Down Expand Up @@ -1583,6 +1619,12 @@
"alias": "weicao wc 葦草",
"alt_name": "Reed"
},
{
"id": "char_4107_vrdant",
"name": "维荻",
"alias": "weidi wd 維荻",
"alt_name": "Verdant"
},
{
"id": "char_275_breeze",
"name": "微风",
Expand Down Expand Up @@ -1661,6 +1703,12 @@
"alias": "xingji xj 星極",
"alt_name": "Astesia"
},
{
"id": "char_4105_almond",
"name": "杏仁",
"alias": "xingren xr 杏仁",
"alt_name": "Almond"
},
{
"id": "char_136_hsguma",
"name": "星熊",
Expand Down
2 changes: 2 additions & 0 deletions src/models/operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export interface Operation {
ratingRatio: number
ratingType: OpRatingType
notEnoughRating: boolean
like: number
dislike: number
commentsCount: number
}

Expand Down

0 comments on commit 93bfb1a

Please sign in to comment.