diff --git a/apps/ethereum/tribes/public/tribes/alchemist.png b/apps/ethereum/tribes/public/tribes/alchemist.png new file mode 100644 index 00000000..d92ad1c1 Binary files /dev/null and b/apps/ethereum/tribes/public/tribes/alchemist.png differ diff --git a/apps/ethereum/tribes/public/tribes/dragon.png b/apps/ethereum/tribes/public/tribes/dragon.png new file mode 100644 index 00000000..adced602 Binary files /dev/null and b/apps/ethereum/tribes/public/tribes/dragon.png differ diff --git a/apps/ethereum/tribes/public/tribes/healer.png b/apps/ethereum/tribes/public/tribes/healer.png new file mode 100644 index 00000000..ae20e731 Binary files /dev/null and b/apps/ethereum/tribes/public/tribes/healer.png differ diff --git a/apps/ethereum/tribes/public/tribes/knight.png b/apps/ethereum/tribes/public/tribes/knight.png new file mode 100644 index 00000000..5c0aef6c Binary files /dev/null and b/apps/ethereum/tribes/public/tribes/knight.png differ diff --git a/apps/ethereum/tribes/public/tribes/mage.png b/apps/ethereum/tribes/public/tribes/mage.png new file mode 100644 index 00000000..97b6e597 Binary files /dev/null and b/apps/ethereum/tribes/public/tribes/mage.png differ diff --git a/apps/ethereum/tribes/src/components/Tribes.ts b/apps/ethereum/tribes/src/components/Tribes.ts new file mode 100644 index 00000000..99f4c8a9 --- /dev/null +++ b/apps/ethereum/tribes/src/components/Tribes.ts @@ -0,0 +1,34 @@ +export const TRIBES = [ +{ + id: 1, + name:"Alchemist", + description: "Alchemists are shrouded in mystery and secrecy. They have the ability to transform any tool info something better.", + image: "/tribes/alchemist.png", +}, + +{ + id: 2, + name: 'Dragon', + description: 'Dragon is a creature of power. Within its body, it contains the treasure every hunter wants.', + image: '/tribes/dragon.png', +}, +{ + id: 3, + name: 'Healer', + description: 'Healers use their knowledge about herbs to heal their fellow teammates. They are good companions on the journey.', + image: '/tribes/healer.png', +}, +{ + id: 4, + name: 'Knight', + description: 'Knight is a master of swords and a believer of physical strikes. They are willing to sacrifice themselves for the final success.', + image: '/tribes/knight.png', +}, +{ + id: 5, + name: 'Mage', + description: 'Mage casts elemental smashes and makes sure every attack hits their targets at all times.', + image: '/tribes/mage.png', +}, + +] \ No newline at end of file diff --git a/apps/ethereum/tribes/src/pages/all-tribes.tsx b/apps/ethereum/tribes/src/pages/all-tribes.tsx index ea273ad4..0dd91811 100644 --- a/apps/ethereum/tribes/src/pages/all-tribes.tsx +++ b/apps/ethereum/tribes/src/pages/all-tribes.tsx @@ -9,6 +9,7 @@ import { toast } from 'react-toastify'; import { useEffect } from 'react'; import Link from 'next/link'; import { useMutation, useQuery } from 'react-query'; +import { TRIBES } from '../components/Tribes'; const AllTribes = () => { const router = useRouter(); @@ -29,7 +30,7 @@ const AllTribes = () => { } }, [isSuccess, router]); - const isLoading = tribes.loading || allTribesLoading || joinTribeLoading; + const isLoading = tribes.loading || joinTribeLoading; useEffect(() => { if (error) { @@ -50,7 +51,7 @@ const AllTribes = () => {

Tribes

{address ? ( - !data || data.length === 0 ? ( + !TRIBES || TRIBES.length === 0 ? ( <>
There are currently no existing tribes.
Go back home @@ -59,13 +60,13 @@ const AllTribes = () => { <>
Select Your Tribe
- {data.map((item) => ( + {TRIBES.map((item) => (
mutate(item.id)}> {item.name}
diff --git a/apps/ethereum/tribes/src/pages/my-tribe.tsx b/apps/ethereum/tribes/src/pages/my-tribe.tsx index 6a6bc558..95c77892 100644 --- a/apps/ethereum/tribes/src/pages/my-tribe.tsx +++ b/apps/ethereum/tribes/src/pages/my-tribe.tsx @@ -8,19 +8,28 @@ import Nav from '../components/Nav'; import Loader from '../components/Loader'; import { toast } from 'react-toastify'; import Image from 'next/image'; +import {TRIBES} from '../components/Tribes'; const TribesPage = () => { const router = useRouter(); const { address: account } = useEthereum(); const tribes = useTribes(); - const { - data, - isLoading: tribeDataLoading, - error: tribeErr, - } = useQuery('tribeAccount', () => tribes.getTribeByAccount!(account!), { + // const { + // data, + // isLoading: tribeDataLoading, + // error: tribeErr, + // } = useQuery('tribeAccount', () => tribes.getTribeByAccount!(account!), { + // enabled: !tribes.loading, + // }); + + const {data, isLoading: tribeDataLoading, + error: tribeErr,} = useQuery('tribeId', () => tribes.getTribeId!(account!), { enabled: !tribes.loading, }); + const tribeData = TRIBES.find(tribe => tribe.id === data); + + const { mutate, isLoading: leaveTribeLoading, @@ -48,26 +57,26 @@ const TribesPage = () => {