Skip to content

Commit

Permalink
- fixed czy0729#184
Browse files Browse the repository at this point in the history
  • Loading branch information
czy0729 committed Aug 29, 2024
1 parent 66f0974 commit 35d2442
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 36 deletions.
10 changes: 8 additions & 2 deletions src/screens/home/v2/component/grid/item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2019-10-20 17:49:25
* @Last Modified by: czy0729
* @Last Modified time: 2024-03-27 05:42:48
* @Last Modified time: 2024-08-30 06:06:43
*/
import React from 'react'
import { View } from 'react-native'
Expand Down Expand Up @@ -46,7 +46,13 @@ function Item({ subject = {}, subjectId = 0, epStatus }: Props, { $ }: Ctx) {
<Opacity subjectId={subjectId}>
<Cover subjectId={subjectId} subject={subject} epStatus={epStatus} />
</Opacity>
{!isGame && <OnairProgress epStatus={epStatus} total={total} current={current} />}
{!isGame && (
<OnairProgress
epStatus={epStatus || 0}
total={Math.max(current || 0, total || 0)}
current={current || 0}
/>
)}
{homeGridTitle && (
<Text style={styles.title} size={11} bold numberOfLines={3} align='center'>
{cnjp(subject.name_cn, subject.name)}
Expand Down
5 changes: 2 additions & 3 deletions src/screens/home/v2/component/grid/item/opacity/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-11-21 02:56:42
* @Last Modified by: czy0729
* @Last Modified time: 2024-04-12 17:20:36
* @Last Modified time: 2024-08-30 06:05:25
*/
import React from 'react'
import { View } from 'react-native'
Expand All @@ -13,8 +13,7 @@ import { styles } from './styles'

function Opacity({ subjectId, children }, { $ }: Ctx) {
const { subject_id: current } = $.state.grid || {}
const isActive = current === subjectId
return <View style={isActive && styles.active}>{children}</View>
return <View style={current === subjectId && styles.active}>{children}</View>
}

export default obc(Opacity, COMPONENT)
4 changes: 2 additions & 2 deletions src/screens/home/v2/component/grid/item/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-06-20 15:48:01
* @Last Modified by: czy0729
* @Last Modified time: 2024-03-27 05:26:40
* @Last Modified time: 2024-08-30 05:56:15
*/
import { _ } from '@stores'

Expand All @@ -20,7 +20,7 @@ export const memoStyles = _.memoStyles(() => {
opacity: 0.5
},
title: {
paddingHorizontal: _.sm,
paddingHorizontal: 2,
marginTop: _.sm,
marginBottom: _.xs
}
Expand Down
4 changes: 2 additions & 2 deletions src/screens/home/v2/component/grid/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2022-06-19 19:22:46
* @Last Modified by: czy0729
* @Last Modified time: 2024-07-10 17:26:46
* @Last Modified time: 2024-08-30 06:02:01
*/
import { _ } from '@stores'

Expand All @@ -28,7 +28,7 @@ export const memoStyles = _.memoStyles(() => {
height: '100%'
},
contentContainerStyle: {
paddingTop: 16,
paddingTop: 20,
paddingBottom: _.tabBarHeight + _.lg + height,
paddingLeft: _.wind - _.sm - 2,
overflow: 'hidden'
Expand Down
22 changes: 2 additions & 20 deletions src/screens/home/v2/component/item/ds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* @Author: czy0729
* @Date: 2024-01-20 09:11:26
* @Last Modified by: czy0729
* @Last Modified time: 2024-03-26 18:04:54
* @Last Modified time: 2024-08-30 05:21:35
*/
import { rc } from '@utils/dev'
import { Override, Subject, SubjectId } from '@types'
import { Subject, SubjectId } from '@types'
import { TabsLabel } from '../../types'
import { COMPONENT as PARENT } from '../ds'

Expand All @@ -24,24 +24,6 @@ export const WEEK_DAY_MAP = {
7: '日'
} as const

/** index.tsx */
export type Props = {
index: number
subjectId: SubjectId
subject: Override<
Subject,
{
/** 收藏时间 (游戏才有) */
time?: string
}
>
title?: TabsLabel

/** 看到多少集 */
epStatus: string | number
}

/** item.tsx */
export const DEFAULT_PROPS = {
index: 0 as number,
title: '' as TabsLabel,
Expand Down
5 changes: 3 additions & 2 deletions src/screens/home/v2/component/item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
* @Author: czy0729
* @Date: 2021-08-09 08:04:06
* @Last Modified by: czy0729
* @Last Modified time: 2024-01-20 09:48:04
* @Last Modified time: 2024-08-30 05:21:55
*/
import React from 'react'
import { obc } from '@utils/decorators'
import { Ctx } from '../../types'
import Item from './item'
import { COMPONENT, Props } from './ds'
import { COMPONENT } from './ds'
import { Props } from './types'

function ItemWrap(
{ index = 0, subjectId = 0, subject = {}, title, epStatus = '' }: Props,
Expand Down
9 changes: 4 additions & 5 deletions src/screens/home/v2/component/item/progress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @Author: czy0729
* @Date: 2021-01-21 16:01:56
* @Last Modified by: czy0729
* @Last Modified time: 2024-01-20 07:43:28
* @Last Modified time: 2024-08-30 05:32:29
*/
import React from 'react'
import { OnairProgress } from '@_'
Expand Down Expand Up @@ -33,10 +33,9 @@ function Progress(

return (
<OnairProgress
// key={String($.$Item(subjectId).doing)}
epStatus={epStatus}
total={total}
current={current}
epStatus={epStatus || 0}
total={Math.max(current || 0, total || 0)}
current={current || 0}
height={systemStore.setting.homeListCompact ? 5 : 6}
/>
)
Expand Down
24 changes: 24 additions & 0 deletions src/screens/home/v2/component/item/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* @Author: czy0729
* @Date: 2024-08-30 05:21:26
* @Last Modified by: czy0729
* @Last Modified time: 2024-08-30 05:21:26
*/
import { Override, Subject, SubjectId } from '@types'
import { TabsLabel } from '../../types'

export type Props = {
index: number
subjectId: SubjectId
subject: Override<
Subject,
{
/** 收藏时间 (游戏才有) */
time?: string
}
>
title?: TabsLabel

/** 看到多少集 */
epStatus: string | number
}

0 comments on commit 35d2442

Please sign in to comment.