mirror of
https://github.com/pawelmalak/flame.git
synced 2025-07-23 21:29:37 +02:00
Cleaned up Apps component. Delete App redux action. Apps edit mode with functionality do delete and pin apps
This commit is contained in:
parent
7e540587a5
commit
cb0b4b495f
10 changed files with 225 additions and 52 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Fragment, useEffect, useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
// Redux
|
||||
|
@ -22,12 +22,11 @@ import Modal from '../UI/Modal/Modal';
|
|||
import AppGrid from './AppGrid/AppGrid';
|
||||
import AppForm from './AppForm/AppForm';
|
||||
import AppTable from './AppTable/AppTable';
|
||||
import Test from '../Test';
|
||||
|
||||
interface ComponentProps {
|
||||
getApps: Function;
|
||||
pinApp: (id: number, isPinned: boolean) => any;
|
||||
addApp: (formData: NewApp) => any;
|
||||
pinApp: (id: number, isPinned: boolean) => void;
|
||||
addApp: (formData: NewApp) => void;
|
||||
apps: App[];
|
||||
loading: boolean;
|
||||
}
|
||||
|
@ -38,17 +37,8 @@ const Apps = (props: ComponentProps): JSX.Element => {
|
|||
|
||||
useEffect(() => {
|
||||
props.getApps();
|
||||
// props.addApp({
|
||||
// name: 'Plex',
|
||||
// url: '192.168.0.128',
|
||||
// icon: 'cat'
|
||||
// })
|
||||
}, [props.getApps]);
|
||||
|
||||
const pinAppHandler = (id: number, state: boolean): void => {
|
||||
props.pinApp(id, state);
|
||||
}
|
||||
|
||||
const toggleModal = (): void => {
|
||||
setModalIsOpen(!modalIsOpen);
|
||||
}
|
||||
|
@ -83,7 +73,7 @@ const Apps = (props: ComponentProps): JSX.Element => {
|
|||
|
||||
<div className={classes.Apps}>
|
||||
{props.loading
|
||||
? 'loading'
|
||||
? <Spinner />
|
||||
: (!isInEdit
|
||||
? <AppGrid apps={props.apps} />
|
||||
: <AppTable />)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue