11import { useState } from 'react' ;
2+ import { useTranslation } from 'react-i18next' ;
23
34import { Divider , Tag } from '@widgets' ;
45import { deleteGameDocument , updateGameDocument } from '@shared' ;
@@ -23,6 +24,7 @@ const MENU_OPTIONS = [
2324] ;
2425
2526const GameCard : FC < GameProps > = ( { id, title, platform, img, status } ) => {
27+ const { t } = useTranslation ( ) ;
2628 const [ showDeleteAlert , setShowAlert ] = useState < boolean > ( false ) ;
2729
2830 const onAlertClick : MouseEventHandler < HTMLButtonElement > = ( event ) => {
@@ -71,22 +73,22 @@ const GameCard: FC<GameProps> = ({ id, title, platform, img, status }) => {
7173 d = "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
7274 />
7375 </ svg >
74- < span > Are you sure about that? </ span >
76+ < span > { t ( 'games-list.cardMenu.deleteAlertText' ) } </ span >
7577 </ div >
7678 < div className = "flex-none" >
7779 < button
7880 className = "btn btn-sm btn-ghost"
7981 data-action = "cancel"
8082 onClick = { onAlertClick }
8183 >
82- Cancel
84+ { t ( 'games-list.cardMenu.cancelDelete' ) }
8385 </ button >
8486 < button
8587 className = "btn btn-sm btn-primary"
8688 data-action = "submit"
8789 onClick = { onAlertClick }
8890 >
89- I really want to delete it
91+ { t ( 'games-list.cardMenu.confirmDelete' ) }
9092 </ button >
9193 </ div >
9294 </ div >
@@ -118,27 +120,29 @@ const GameCard: FC<GameProps> = ({ id, title, platform, img, status }) => {
118120 tabIndex = { 0 }
119121 className = "menu menu-compact dropdown-content mt-3 p-2 shadow w-52 bg-primary-content text-primary"
120122 >
121- < Divider > Statuses </ Divider >
123+ < Divider > { t ( 'games-list.cardMenu.statuses' ) } </ Divider >
122124 { MENU_OPTIONS . filter ( ( option ) => option . key !== status ) . map ( ( option ) => (
123125 < li
124126 key = { option . key }
125127 data-key = { option . key }
126128 onClick = { onStatusChange }
127129 className = "hover:bg-primary-focus hover:text-primary-content rounded-none bg-primary-content p-2"
128130 >
129- { option . label }
131+ { t ( `games-list.cardMenu. ${ option . key } ` ) }
130132 </ li >
131133 ) ) }
132- < Divider > Actions </ Divider >
134+ < Divider > { t ( 'games-list.cardMenu.actions' ) } </ Divider >
133135 < li >
134136 < button className = "btn btn-warning" onClick = { onDeleteClick } >
135- Delete
137+ { t ( 'games-list.cardMenu.delete' ) }
136138 </ button >
137139 </ li >
138140 </ ul >
139141 </ div >
140- < h2 className = "card-title" > { title } </ h2 >
141- < Tag platform = { platform } />
142+ < div className = "absolute left-4 bottom-6" >
143+ < h2 className = "card-title mb-2" > { title } </ h2 >
144+ < Tag platform = { platform } />
145+ </ div >
142146 </ div >
143147 </ div >
144148 </ >
0 commit comments