diff --git a/src/components/Form/Switch/Switch.tsx b/src/components/Form/Switch/Switch.tsx
new file mode 100644
index 0000000..4c10780
--- /dev/null
+++ b/src/components/Form/Switch/Switch.tsx
@@ -0,0 +1,53 @@
+import React from 'react';
+import { useController } from 'react-hook-form';
+import { Switch as HeadlessSwitch } from '@headlessui/react';
+
+function classNames(...classes: any) {
+ return classes.filter(Boolean).join(' ');
+}
+/* eslint-disable react/react-in-jsx-scope */
+export const Switch = ({ control, name, label, required }: SwitchProps) => {
+ const {
+ field,
+ // fieldState: { invalid, isTouched, isDirty },
+ // formState: { touchedFields, dirtyFields },
+ } = useController({
+ name,
+ control,
+ rules: { required },
+ defaultValue: '',
+ });
+
+ return (
+ <>
+ {label && (
+
+ )}
+
+
+
+ >
+ );
+};
+
+type SwitchProps = {
+ control: any;
+ name: string;
+ label?: string;
+ required?: boolean;
+};
diff --git a/src/components/Form/Switch/index.ts b/src/components/Form/Switch/index.ts
new file mode 100644
index 0000000..cee89a1
--- /dev/null
+++ b/src/components/Form/Switch/index.ts
@@ -0,0 +1 @@
+export { Switch } from './Switch';
diff --git a/src/components/Form/index.ts b/src/components/Form/index.ts
index ad493dd..1fc764c 100644
--- a/src/components/Form/index.ts
+++ b/src/components/Form/index.ts
@@ -1,2 +1,3 @@
export { Input } from './Input';
export { Select } from './Select';
+export { Switch } from './Switch';
diff --git a/src/modules/apps/AppSingle.tsx b/src/modules/apps/AppSingle.tsx
index a3602e9..79c0cc5 100644
--- a/src/modules/apps/AppSingle.tsx
+++ b/src/modules/apps/AppSingle.tsx
@@ -1,26 +1,40 @@
-import React from 'react';
+import React, { useEffect } from 'react';
import { useParams } from 'react-router-dom';
import _ from 'lodash';
import { XCircleIcon } from '@heroicons/react/outline';
+import { useApps } from 'src/services/apps';
import { Tabs } from 'src/components';
import { appAccessList } from 'src/components/UserModal/consts';
import { AdvancedTab, GeneralTab } from './components';
-const pages = [
- { name: 'Apps', to: '/apps', current: true },
- { name: 'Nextcloud', to: '', current: false },
-];
-
-const tabs = [
- { name: 'General', component: },
- { name: 'Advanced Configuration', component: },
-];
-
export const AppSingle: React.FC = () => {
const params = useParams();
const appSlug = params.slug;
+ const { app, loadApp } = useApps();
- const appInfo = _.find(appAccessList, { name: appSlug });
+ useEffect(() => {
+ if (appSlug) {
+ loadApp(appSlug);
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [appSlug]);
+
+ if (!app) {
+ return null;
+ }
+ const appImageSrc = _.find(appAccessList, { name: appSlug })?.image;
+
+ const handleAutomaticUpdatesChange = () => {
+ app.automaticUpdates = !app.automaticUpdates;
+ };
+
+ const tabs = [
+ {
+ name: 'General',
+ component: ,
+ },
+ { name: 'Advanced Configuration', component: },
+ ];
return (
@@ -29,9 +43,9 @@ export const AppSingle: React.FC = () => {
style={{ height: 'fit-content' }}
>
-
+
-
{appInfo?.label}
+
{app.name}
Installed on August 25, 2020