Skip to content

Commit

Permalink
Fix/feat for Launchpad + UI (#22)
Browse files Browse the repository at this point in the history
* detail launch + ui

* modal + ui fix
  • Loading branch information
MSghais authored Aug 19, 2024
1 parent bd7017e commit c5fd7e7
Show file tree
Hide file tree
Showing 28 changed files with 1,211 additions and 124 deletions.
68 changes: 48 additions & 20 deletions apps/mobile/src/app/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { useAuth } from 'afk_nostr_sdk';
import { createDrawerNavigator } from '@react-navigation/drawer';
import { Navbar } from '../components/Navbar';
import { Settings } from '../screens/Settings';
import { LaunchDetail } from '../screens/LaunchDetail';

const DrawerStack = createDrawerNavigator<MainStackParams>();
const RootStack = createNativeStackNavigator<RootStackParams>();
Expand Down Expand Up @@ -110,25 +111,48 @@ const HomeBottomTabNavigator: React.FC = () => {
}}
/>

<HomeBottomTabsStack.Screen
name="UserProfile"
component={Profile as any}
initialParams={{ publicKey }}
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
<View style={styles.tabBarIcon}>
<Icon
name="UserIcon"
size={24}
color={focused ? 'bottomBarActive' : 'bottomBarInactive'}
/>
{focused && <Icon name="IndicatorIcon" color="primary" size={6} />}
</View>
),
}}
/>
{publicKey &&
<HomeBottomTabsStack.Screen
name="UserProfile"
component={Profile as any}
initialParams={{ publicKey }}
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
<View style={styles.tabBarIcon}>
<Icon
name="UserIcon"
size={24}
color={focused ? 'bottomBarActive' : 'bottomBarInactive'}
/>
{focused && <Icon name="IndicatorIcon" color="primary" size={6} />}
</View>
),
}}
/>
}

{!publicKey &&
<HomeBottomTabsStack.Screen
name="Login"
component={Login as any}
options={{
tabBarActiveTintColor: 'white',
tabBarInactiveTintColor: 'grey',
tabBarIcon: ({ focused }) => (
<View style={styles.tabBarIcon}>
<Icon
name="UserIcon"
size={24}
color={focused ? 'bottomBarActive' : 'bottomBarInactive'}
/>
{focused && <Icon name="IndicatorIcon" color="primary" size={6} />}
</View>
),
}}
/>
}
</HomeBottomTabsStack.Navigator>
);
};
Expand Down Expand Up @@ -189,7 +213,6 @@ const MainNavigator: React.FC = () => {
<DrawerStack.Screen name="Home" component={HomeBottomTabNavigator} />
:
<DrawerStack.Screen name="Feed" component={Feed} />

}
<DrawerStack.Screen name="Profile" component={Profile} />
<DrawerStack.Screen name="EditProfile" component={EditProfile} />
Expand All @@ -204,6 +227,10 @@ const MainNavigator: React.FC = () => {
<DrawerStack.Screen name="Games" component={Games} />
<DrawerStack.Screen name="Tips" component={Tips} />
<DrawerStack.Screen name="Settings" component={Settings} />
<DrawerStack.Screen name="LaunchDetail" component={LaunchDetail} />
<DrawerStack.Screen name="Auth" component={AuthNavigator} />
<DrawerStack.Screen name="Login" component={Login} />

</DrawerStack.Navigator>
);
};
Expand Down Expand Up @@ -263,6 +290,7 @@ const RootNavigator: React.FC = () => {

return (
<RootStack.Navigator screenOptions={{ headerShown: false }}>
{/* <RootStack.Screen name="MainStack" component={MainNavigator} /> */}
{publicKey ? (
<RootStack.Screen name="MainStack" component={MainNavigator} />
) : (
Expand Down
5 changes: 4 additions & 1 deletion apps/mobile/src/app/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { StarknetProvider } from './StarknetProvider';
import { TanstackProvider } from 'afk_nostr_sdk';
import { NostrProvider } from 'afk_nostr_sdk';
import { TipModalStarknetProvider } from '../context/TipModalStarknet';
import { TokenCreateModalProvider } from '../context/TokenCreateModal';
const queryClient = new QueryClient({
defaultOptions: { queries: { retry: 2 } },
});
Expand All @@ -28,7 +29,9 @@ const ModalProviders = ({ children }: { children: React.ReactNode }) => {
<TransactionModalProvider>
<TipModalProvider>
<TipModalStarknetProvider>
<KeyModalProvider>{children}</KeyModalProvider>
<TokenCreateModalProvider>
<KeyModalProvider>{children}</KeyModalProvider>
</TokenCreateModalProvider>
</TipModalStarknetProvider>
</TipModalProvider>
</TransactionModalProvider>
Expand Down
23 changes: 19 additions & 4 deletions apps/mobile/src/components/TokenLaunchCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ export type LaunchCoinProps = {
name?: string;
event?: NDKEvent;
profileProps?: NDKUserProfile;
launch?: TokenLaunchInterface
launch?: TokenLaunchInterface;
isViewDetailDisabled?: boolean;
};

enum AmountType {
QUOTE_AMOUNT,
COIN_AMOUNT_TO_BUY
}
export const TokenLaunchCard: React.FC<LaunchCoinProps> = ({ launch, imageProps, name, profileProps, event }) => {
export const TokenLaunchCard: React.FC<LaunchCoinProps> = ({ launch, imageProps, name, profileProps, event, isViewDetailDisabled }) => {
const { data: profile } = useProfile({ publicKey: event?.pubkey });
const account = useAccount()

Expand Down Expand Up @@ -148,7 +149,7 @@ export const TokenLaunchCard: React.FC<LaunchCoinProps> = ({ launch, imageProps,
</Text> */}

<Text>
Supply: {Number(launch?.total_supply) / 10 **18}
Supply: {Number(launch?.total_supply) / 10 ** 18}
</Text>
<Text>
Price: {Number(launch?.price)}
Expand All @@ -164,7 +165,7 @@ export const TokenLaunchCard: React.FC<LaunchCoinProps> = ({ launch, imageProps,

{launch?.token_quote &&
<View
// style={styles.imageContainer}
// style={styles.imageContainer}
>
<Text>Token quote</Text>
<Text>
Expand Down Expand Up @@ -204,6 +205,20 @@ export const TokenLaunchCard: React.FC<LaunchCoinProps> = ({ launch, imageProps,

</Button>
</View>


{!isViewDetailDisabled &&
<View> <Button onPress={() => {
if (launch && launch?.token_address) {
navigation.navigate("LaunchDetail", { coinAddress: feltToAddress(BigInt(launch?.token_address)), launch: launch })
}
}}>View details
</Button>
</View>
}



</View>
);
};
4 changes: 2 additions & 2 deletions apps/mobile/src/components/TokenLaunchCard/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default ThemedStyleSheet((theme) => ({
borderRadius: 8,
gap: Spacing.xsmall,
overflowWrap:"break-word",
width:Dimensions.get("window").width >= 1024 ? 300 : "100%"
// width:Dimensions.get("window").width >= 1024 ? 300 : "100%"
// width:"100%"
// width:300,
width:300,
},
imageContainer: {
// position: 'relative',
Expand Down
Loading

0 comments on commit c5fd7e7

Please sign in to comment.