Skip to content

Commit

Permalink
feat: add web support
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Mar 22, 2024
1 parent fb39814 commit d68597f
Show file tree
Hide file tree
Showing 21 changed files with 172 additions and 243 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
19 changes: 18 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { MaterialIcons } from '@expo/vector-icons';
import { DefaultTheme } from '@react-navigation/native';
import * as Font from 'expo-font';
import * as Linking from 'expo-linking';
import * as SplashScreen from 'expo-splash-screen';
import { StatusBar } from 'expo-status-bar';
import React, { useEffect } from 'react';
Expand All @@ -8,6 +10,14 @@ import Navigation from './src/components/Navigation';

SplashScreen.preventAutoHideAsync();

const theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: '#000',
},
};

export default function App() {
const [fontsLoaded, setFontsLoaded] = React.useState(false);

Expand All @@ -28,7 +38,14 @@ export default function App() {
return (
<>
<StatusBar translucent />
<Navigation onReady={() => SplashScreen.hideAsync()} />
<Navigation
theme={theme}
onReady={() => SplashScreen.hideAsync()}
linking={{
prefixes: [Linking.createURL('/')],
config: 'auto',
}}
/>
</>
);
}
1 change: 1 addition & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"expo": {
"name": "PocketGear",
"slug": "pocket-gear",
"scheme": "pocketgear",
"privacy": "public",
"platforms": [
"ios",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
},
"packageManager": "yarn@4.1.1",
"dependencies": {
"@expo/metro-runtime": "~3.1.3",
"@expo/vector-icons": "^14.0.0",
"@react-navigation/elements": "^2.0.0-alpha.15",
"@react-navigation/material-top-tabs": "^7.0.0-alpha.17",
Expand All @@ -17,6 +18,7 @@
"expo": "^50.0.14",
"expo-blur": "~12.9.2",
"expo-font": "~11.10.3",
"expo-linking": "~6.2.2",
"expo-splash-screen": "~0.26.4",
"expo-status-bar": "~1.11.1",
"expo-updates": "~0.24.12",
Expand Down
77 changes: 0 additions & 77 deletions src/components/Appbar.tsx

This file was deleted.

66 changes: 0 additions & 66 deletions src/components/AppbarShell.tsx

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/CPCalculator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ function CPCalculator({ pokemon, style }: Props) {
setValue((prev) => prev - 1);
};

const pokemons = store.getPokemons();

if (!pokemon.evolution_cp_multipliers) {
return (
<View style={style}>
Expand All @@ -65,13 +63,15 @@ function CPCalculator({ pokemon, style }: Props) {
/>
<View style={styles.container}>
{pokemon.evolution_cp_multipliers.map((it) => {
const poke = pokemons.find((p) => p.id === it.id);
const poke = store.getPokemon(it.id);
const minimum = (value || 0) * it.multipliers.minimum;
const maximum = (value || 0) * it.multipliers.maximum;
const average = (minimum + maximum) / 2;

if (!poke) {
return null;
}

return (
<TouchableOpacity key={it.id} onPress={() => goToPokemon(it.id)}>
<View style={styles.pokemon}>
Expand Down
9 changes: 4 additions & 5 deletions src/components/Evolution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ function Evolution(props: Props) {
};

const getEvolutions = (pokemon: Pokemon): Pokemon[] | undefined => {
const pokemons = store.getPokemons();
const { evolution } = pokemon;

return evolution && evolution.branch
? (evolution.branch
.map((ev) => pokemons.find((p) => p.id === ev.id))
.map((ev) => store.getPokemon(ev.id))
.filter(Boolean) as Pokemon[])
: undefined;
};

const pokemons = store.getPokemons();
const { pokemon } = props;
const { evolution } = pokemon;

Expand Down Expand Up @@ -67,7 +65,8 @@ function Evolution(props: Props) {

while (curr.evolution && curr.evolution.parent) {
const { parent } = curr.evolution;
const poke = pokemons.find((p) => p.id === parent);
const poke = store.getPokemon(parent);

if (poke) {
curr = poke;
parents = [poke, ...parents];
Expand All @@ -80,7 +79,7 @@ function Evolution(props: Props) {
chain.map((poke) => {
if (poke.evolution && poke.evolution.parent) {
const { parent } = poke.evolution;
const prev = pokemons.find((p) => p.id === parent);
const prev = store.getPokemon(parent);

if (prev && prev.evolution && prev.evolution.branch) {
const ev = prev.evolution.branch.find(({ id }) => id === poke.id);
Expand Down
Loading

0 comments on commit d68597f

Please sign in to comment.