chore: lint

This commit is contained in:
karishmas6
2024-09-10 03:09:34 +05:30
parent 8353ca7817
commit 4a455c7768

View File

@@ -15,7 +15,7 @@ import { useGlobalInfoStore } from "../../context/globalInfo";
import { deleteRecordingFromStorage, getStoredRecordings } from "../../api/storage"; import { deleteRecordingFromStorage, getStoredRecordings } from "../../api/storage";
interface Column { interface Column {
id: 'interpret' | 'name' | 'create_date' | 'edit' | 'pairs' | 'update_date'| 'delete'; id: 'interpret' | 'name' | 'create_date' | 'edit' | 'pairs' | 'update_date' | 'delete';
label: string; label: string;
minWidth?: number; minWidth?: number;
align?: 'right'; align?: 'right';
@@ -65,8 +65,8 @@ interface Data {
} }
interface RecordingsTableProps { interface RecordingsTableProps {
handleEditRecording: (fileName:string) => void; handleEditRecording: (fileName: string) => void;
handleRunRecording: (fileName:string, params: string[]) => void; handleRunRecording: (fileName: string, params: string[]) => void;
} }
export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: RecordingsTableProps) => { export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: RecordingsTableProps) => {
@@ -106,7 +106,7 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: Rec
} }
} }
useEffect( () => { useEffect(() => {
if (rows.length === 0) { if (rows.length === 0) {
fetchRecordings(); fetchRecordings();
} }
@@ -138,7 +138,7 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: Rec
<TableRow hover role="checkbox" tabIndex={-1} key={row.id}> <TableRow hover role="checkbox" tabIndex={-1} key={row.id}>
{columns.map((column) => { {columns.map((column) => {
// @ts-ignore // @ts-ignore
const value : any = row[column.id]; const value: any = row[column.id];
if (value !== undefined) { if (value !== undefined) {
return ( return (
<TableCell key={column.id} align={column.align}> <TableCell key={column.id} align={column.align}>
@@ -150,23 +150,23 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: Rec
case 'interpret': case 'interpret':
return ( return (
<TableCell key={column.id} align={column.align}> <TableCell key={column.id} align={column.align}>
<InterpretButton handleInterpret={() => handleRunRecording(row.name, row.params || [])}/> <InterpretButton handleInterpret={() => handleRunRecording(row.name, row.params || [])} />
</TableCell> </TableCell>
); );
case 'edit': case 'edit':
return ( return (
<TableCell key={column.id} align={column.align}> <TableCell key={column.id} align={column.align}>
<IconButton aria-label="add" size= "small" onClick={() => { <IconButton aria-label="add" size="small" onClick={() => {
handleEditRecording(row.name); handleEditRecording(row.name);
}} sx={{'&:hover': { color: '#1976d2', backgroundColor: 'transparent' }}}> }} sx={{ '&:hover': { color: '#1976d2', backgroundColor: 'transparent' } }}>
<Edit/> <Edit />
</IconButton> </IconButton>
</TableCell> </TableCell>
); );
case 'delete': case 'delete':
return ( return (
<TableCell key={column.id} align={column.align}> <TableCell key={column.id} align={column.align}>
<IconButton aria-label="add" size= "small" onClick={() => { <IconButton aria-label="add" size="small" onClick={() => {
deleteRecordingFromStorage(row.name).then((result: boolean) => { deleteRecordingFromStorage(row.name).then((result: boolean) => {
if (result) { if (result) {
setRows([]); setRows([]);
@@ -174,20 +174,20 @@ export const RecordingsTable = ({ handleEditRecording, handleRunRecording }: Rec
fetchRecordings(); fetchRecordings();
} }
}) })
}} sx={{'&:hover': { color: '#1976d2', backgroundColor: 'transparent' }}}> }} sx={{ '&:hover': { color: '#1976d2', backgroundColor: 'transparent' } }}>
<DeleteForever/> <DeleteForever />
</IconButton> </IconButton>
</TableCell> </TableCell>
); );
default: default:
return null; return null;
} }
} }
})} })}
</TableRow> </TableRow>
); );
}) })
: null } : null}
</TableBody> </TableBody>
</Table> </Table>
</TableContainer> </TableContainer>
@@ -208,13 +208,13 @@ interface InterpretButtonProps {
handleInterpret: () => void; handleInterpret: () => void;
} }
const InterpretButton = ( {handleInterpret}:InterpretButtonProps) => { const InterpretButton = ({ handleInterpret }: InterpretButtonProps) => {
return ( return (
<IconButton aria-label="add" size= "small" onClick={() => { <IconButton aria-label="add" size="small" onClick={() => {
handleInterpret(); handleInterpret();
}} }}
sx={{'&:hover': { color: '#1976d2', backgroundColor: 'transparent' }}}> sx={{ '&:hover': { color: '#1976d2', backgroundColor: 'transparent' } }}>
<PlayCircle/> <PlayCircle />
</IconButton> </IconButton>
) )
} }