mirror of
https://github.com/apotdevin/thunderhub.git
synced 2025-02-22 22:25:21 +01:00
* feat: ✨ server sso auth * chore: 🔧 continue sso integration * fix: 🐛 correct filter * chore: 🔧 add resolver types * chore: 🔧 linter sort imports * fix: 🐛 duplicate imports * chore: 🔧 change auth context * feat: ✨ add accounts read and query * fix: 🐛 small changes * chore: 🔧 continue integration * chore: 🔧 add auth * chore: 🔧 switch to new context * fix: 🐛 imports and account context * chore: 🔧 add session token query * chore: 🔧 change server auth * chore: 🔧 add sso to server accounts query * chore: 🔧 cleanup and small fixes * chore: 🔧 separate generated files * refactor: ♻️ change graphql imports * fix: 🐛 add id to params * fix: 🐛 auth changes * chore: 🔧 improve logging and account fixes * chore: 🔧 change footer * chore: 🔧 remove console logs * chore: 🔧 add spacing * fix: 🐛 final changes
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { useAccountState } from 'src/context/AccountContext';
|
|
import { useGetPeersQuery } from 'src/graphql/queries/__generated__/getPeers.generated';
|
|
import {
|
|
CardWithTitle,
|
|
SubTitle,
|
|
Card,
|
|
} from '../src/components/generic/Styled';
|
|
import { PeersCard } from '../src/views/peers/PeersCard';
|
|
import { LoadingCard } from '../src/components/loading/LoadingCard';
|
|
import { AddPeer } from '../src/views/peers/AddPeer';
|
|
|
|
const PeersView = () => {
|
|
const [indexOpen, setIndexOpen] = useState(0);
|
|
const { auth } = useAccountState();
|
|
|
|
const { loading, data } = useGetPeersQuery({
|
|
skip: !auth,
|
|
variables: { auth },
|
|
});
|
|
|
|
if (loading || !data || !data.getPeers) {
|
|
return <LoadingCard title={'Peers'} />;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<AddPeer />
|
|
<CardWithTitle>
|
|
<SubTitle>Peers</SubTitle>
|
|
<Card>
|
|
{data.getPeers.map((peer: any, index: number) => (
|
|
<PeersCard
|
|
peer={peer}
|
|
index={index + 1}
|
|
setIndexOpen={setIndexOpen}
|
|
indexOpen={indexOpen}
|
|
key={`${index}-${peer.public_key}`}
|
|
/>
|
|
))}
|
|
</Card>
|
|
</CardWithTitle>
|
|
</>
|
|
);
|
|
};
|
|
|
|
export default PeersView;
|