Skip to content

Commit

Permalink
feat(alby): remove info card #632
Browse files Browse the repository at this point in the history
  • Loading branch information
escapedcat committed Jul 25, 2023
1 parent 54a3314 commit 9cd012f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 204 deletions.
15 changes: 3 additions & 12 deletions src/pages/Apps/AppCardAlby.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InformationCircleIcon, PlusIcon } from "@heroicons/react/24/outline";
import { PlusIcon } from "@heroicons/react/24/outline";
import { FC } from "react";
import { useTranslation } from "react-i18next";
import { App } from "../..//models/app.model";
Expand All @@ -8,10 +8,9 @@ import { instance } from "../../utils/interceptor";

export type Props = {
appInfo: App;
onOpenDetails: (app: App) => void;
};

export const AppCard: FC<Props> = ({ appInfo, onOpenDetails }) => {
export const AppCardAlby: FC<Props> = ({ appInfo }) => {
const { id, name } = appInfo;
const { t } = useTranslation();

Expand Down Expand Up @@ -94,17 +93,9 @@ export const AppCard: FC<Props> = ({ appInfo, onOpenDetails }) => {
{t(`appInfo.${id}.action.install`)}
</a>
)}

<button
className="flex w-1/2 items-center justify-center rounded p-2 shadow-md hover:bg-gray-300 dark:bg-gray-500 dark:hover:bg-gray-300 dark:hover:text-black"
onClick={() => onOpenDetails(appInfo)}
>
<InformationCircleIcon className="inline h-6 w-6" />
&nbsp;{t("apps.info")}
</button>
</div>
</div>
);
};

export default AppCard;
export default AppCardAlby;
171 changes: 0 additions & 171 deletions src/pages/Apps/AppInfoAlby.tsx

This file was deleted.

33 changes: 12 additions & 21 deletions src/pages/Apps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { instance } from "../../utils/interceptor";
import AppCard from "./AppCard";
import AppCardAlby from "./AppCardAlby";
import AppInfo from "./AppInfo";
import AppInfoAlby from "./AppInfoAlby";

export const Apps: FC = () => {
const { t } = useTranslation(["translation", "apps"]);
Expand Down Expand Up @@ -61,22 +60,17 @@ export const Apps: FC = () => {
};

if (showDetails && app) {
let appInfos;
if (app.id === "alby") {
return <AppInfoAlby app={app} onClose={closeDetailsHandler} />;
} else {
appInfos = appStatus.find((a) => a.id === app.id)!;
return (
<AppInfo
app={app}
appStatusInfo={appInfos}
installingApp={installingApp}
onInstall={() => installHandler(app.id)}
onUninstall={() => uninstallHandler(app.id)}
onClose={closeDetailsHandler}
/>
);
}
const appInfos = appStatus.find((a) => a.id === app.id)!;
return (
<AppInfo
app={app}
appStatusInfo={appInfos}
installingApp={installingApp}
onInstall={() => installHandler(app.id)}
onUninstall={() => uninstallHandler(app.id)}
onClose={closeDetailsHandler}
/>
);
}

return (
Expand Down Expand Up @@ -130,10 +124,7 @@ export const Apps: FC = () => {
})}

<article>
<AppCardAlby
appInfo={availableApps.get("alby")!}
onOpenDetails={openDetailsHandler}
/>
<AppCardAlby appInfo={availableApps.get("alby")!} />
</article>
</div>
</section>
Expand Down

0 comments on commit 9cd012f

Please sign in to comment.