Skip to content

Commit

Permalink
feat: quick prototype for apps in the sidebar (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
reneaaron committed Sep 24, 2024
1 parent f14a828 commit 629010e
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 2 deletions.
Binary file added frontend/src/assets/suggested-apps/bitrefill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions frontend/src/components/SuggestedAppData.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import albyGo from "src/assets/suggested-apps/alby-go.png";
import alby from "src/assets/suggested-apps/alby.png";
import amethyst from "src/assets/suggested-apps/amethyst.png";
import bitrefill from "src/assets/suggested-apps/bitrefill.png";
import buzzpay from "src/assets/suggested-apps/buzzpay.png";
import damus from "src/assets/suggested-apps/damus.png";
import hablanews from "src/assets/suggested-apps/habla-news.png";
Expand Down Expand Up @@ -199,4 +200,13 @@ export const suggestedApps: SuggestedApp[] = [
logo: albyGo,
internal: true,
},
{
id: "bitrefill",
title: "Bitrefill",
description:
"Live on Bitcoin - Shop for Gift Cards, eSIMs, and Mobile Recharges",
webLink: "https://bitrefill.com",
logo: bitrefill,
internal: true,
},
].sort((a, b) => (a.title.toUpperCase() > b.title.toUpperCase() ? 1 : -1));
8 changes: 8 additions & 0 deletions frontend/src/components/layouts/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import {
} from "src/components/ui/tooltip";
import { useAlbyMe } from "src/hooks/useAlbyMe";

import bitrefill from "src/assets/suggested-apps/bitrefill.png";
import { Badge } from "src/components/ui/badge";
import { useAlbyInfo } from "src/hooks/useAlbyInfo";
import { useInfo } from "src/hooks/useInfo";
import { useRemoveSuccessfulChannelOrder } from "src/hooks/useRemoveSuccessfulChannelOrder";
Expand Down Expand Up @@ -146,6 +148,12 @@ export default function AppLayout() {
<Store className="h-4 w-4" />
App Store
</MenuItem>
<div className="ml-6 mt-2">
<MenuItem to="/internal-apps/bitrefill">
<img src={bitrefill} className="h-4 w-4 rounded" />
Bitrefill <Badge variant="destructive">NEW</Badge>
</MenuItem>
</div>
</>
);
}
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { FirstChannel } from "src/screens/channels/first/FirstChannel";
import { OpenedFirstChannel } from "src/screens/channels/first/OpenedFirstChannel";
import { OpeningFirstChannel } from "src/screens/channels/first/OpeningFirstChannel";
import { AlbyGo } from "src/screens/internal-apps/AlbyGo";
import { Bitrefill } from "src/screens/internal-apps/Bitrefill";
import { BuzzPay } from "src/screens/internal-apps/BuzzPay";
import { UncleJim } from "src/screens/internal-apps/UncleJim";
import BuyBitcoin from "src/screens/onchain/BuyBitcoin";
Expand Down Expand Up @@ -221,6 +222,10 @@ const routes = [
path: "alby-go",
element: <AlbyGo />,
},
{
path: "bitrefill",
element: <Bitrefill />,
},
],
},
{
Expand Down
47 changes: 47 additions & 0 deletions frontend/src/screens/internal-apps/Bitrefill.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Link } from "react-router-dom";
import AppHeader from "src/components/AppHeader";
import { NostrWalletConnectIcon } from "src/components/icons/NostrWalletConnectIcon";
import { suggestedApps } from "src/components/SuggestedAppData";
import { Button } from "src/components/ui/button";

const BITREFILL_APP_ID = "bitrefill";

export function Bitrefill() {
const app = suggestedApps.find((x) => x.id === BITREFILL_APP_ID);

return (
<div className="grid gap-5">
<AppHeader
title={
<>
<div className="flex flex-row items-center">
<img src={app?.logo} className="w-14 h-14 rounded-lg mr-4" />
<div className="flex flex-col">
<div>{app?.title}</div>
<div className="text-sm font-normal text-muted-foreground">
{app?.description}
</div>
</div>
</div>
</>
}
description=""
contentRight={
<Link to={`/apps/new?app=${app?.id}`}>
<Button variant="outline">
<NostrWalletConnectIcon className="w-4 h-4 mr-2" />
Connect to {app?.title}
</Button>
</Link>
}
/>
<iframe
className="w-full rounded-lg flex-1"
width="375"
height="667"
src="https://embed.bitrefill.com/?showPaymentInfo=true"
sandbox="allow-same-origin allow-popups allow-scripts allow-forms"
></iframe>
</div>
);
}
3 changes: 1 addition & 2 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@ const insertDevCSPPlugin: Plugin = {
return html.replace(
"<head>",
`<head>
<!-- DEV-ONLY CSP - when making changes here, also update the CSP header in http_service.go (without the nonce!) -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self' ${DEVELOPMENT_NONCE}; img-src 'self' https://uploads.getalby-assets.com https://getalby.com; connect-src 'self' https://api.getalby.com"/>`
<!-- DEV-ONLY CSP - when making changes here, also update the CSP header in http_service.go (without the nonce!) -->`
);
},
},
Expand Down

0 comments on commit 629010e

Please sign in to comment.