mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 02:07:55 +00:00
feat: add Exchange button in finance card linking to exchange.pezkuwichain.io
- Use PezkuwiExchange.png logo instead of emoji for exchange app icon - External link opens exchange.pezkuwichain.io in new tab (noopener) - No auth required (exchange is publicly accessible) - Added imgIcon and href fields to AppItem interface
This commit is contained in:
@@ -33,7 +33,9 @@ const getEmojiFromAvatarId = (avatarId: string): string => {
|
|||||||
interface AppItem {
|
interface AppItem {
|
||||||
title: string;
|
title: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
|
imgIcon?: string; // image path instead of emoji
|
||||||
route: string;
|
route: string;
|
||||||
|
href?: string; // external URL (opens in new tab)
|
||||||
comingSoon?: boolean;
|
comingSoon?: boolean;
|
||||||
requiresAuth?: boolean;
|
requiresAuth?: boolean;
|
||||||
}
|
}
|
||||||
@@ -54,7 +56,7 @@ const APP_SECTIONS: AppSection[] = [
|
|||||||
apps: [
|
apps: [
|
||||||
{ title: 'mobile.app.wallet', icon: '👛', route: '/wallet' },
|
{ title: 'mobile.app.wallet', icon: '👛', route: '/wallet' },
|
||||||
{ title: 'mobile.app.bank', icon: '🏦', route: '/finance/bank' },
|
{ title: 'mobile.app.bank', icon: '🏦', route: '/finance/bank' },
|
||||||
{ title: 'mobile.app.exchange', icon: '💱', route: '/dex', requiresAuth: true },
|
{ title: 'mobile.app.exchange', icon: '💱', imgIcon: '/PezkuwiExchange.png', route: '/dex', href: 'https://exchange.pezkuwichain.io' },
|
||||||
{ title: 'mobile.app.p2p', icon: '🤝', route: '/p2p', requiresAuth: true },
|
{ title: 'mobile.app.p2p', icon: '🤝', route: '/p2p', requiresAuth: true },
|
||||||
{ title: 'mobile.app.b2b', icon: '🤖', route: '/bereketli', requiresAuth: true },
|
{ title: 'mobile.app.b2b', icon: '🤖', route: '/bereketli', requiresAuth: true },
|
||||||
{ title: 'mobile.app.bacZekat', icon: '💰', route: '/finance/zekat' },
|
{ title: 'mobile.app.bacZekat', icon: '💰', route: '/finance/zekat' },
|
||||||
@@ -292,19 +294,31 @@ const MobileHomeLayout: React.FC = () => {
|
|||||||
<div className="grid grid-cols-4 gap-1 px-3 py-3">
|
<div className="grid grid-cols-4 gap-1 px-3 py-3">
|
||||||
{section.apps.map((app) => {
|
{section.apps.map((app) => {
|
||||||
const needsLogin = app.requiresAuth && !user;
|
const needsLogin = app.requiresAuth && !user;
|
||||||
|
|
||||||
|
function handleClick() {
|
||||||
|
if (app.comingSoon) return;
|
||||||
|
if (needsLogin) { navigate('/login'); return; }
|
||||||
|
if (app.href) { window.open(app.href, '_blank', 'noopener,noreferrer'); return; }
|
||||||
|
navigate(app.route);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
key={app.title}
|
key={app.title}
|
||||||
onClick={() => {
|
onClick={handleClick}
|
||||||
if (app.comingSoon) return;
|
|
||||||
if (needsLogin) { navigate('/login'); return; }
|
|
||||||
navigate(app.route);
|
|
||||||
}}
|
|
||||||
className={`flex flex-col items-center gap-1 py-2 px-1 rounded-xl transition-all active:scale-95
|
className={`flex flex-col items-center gap-1 py-2 px-1 rounded-xl transition-all active:scale-95
|
||||||
${app.comingSoon ? 'opacity-50' : 'hover:bg-gray-800/60'}`}
|
${app.comingSoon ? 'opacity-50' : 'hover:bg-gray-800/60'}`}
|
||||||
>
|
>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<span className="text-2xl">{app.icon}</span>
|
{app.imgIcon ? (
|
||||||
|
<img
|
||||||
|
src={app.imgIcon}
|
||||||
|
alt={t(app.title)}
|
||||||
|
className="w-8 h-8 object-contain rounded-lg"
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<span className="text-2xl">{app.icon}</span>
|
||||||
|
)}
|
||||||
{app.comingSoon && (
|
{app.comingSoon && (
|
||||||
<span className="absolute -top-1 -right-2 text-[10px]">🔒</span>
|
<span className="absolute -top-1 -right-2 text-[10px]">🔒</span>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user