update demo-score-board,
This commit is contained in:
@@ -31,8 +31,8 @@ import FinishModal from '../components/FinishModal';
|
|||||||
import { useParams } from 'react-router';
|
import { useParams } from 'react-router';
|
||||||
|
|
||||||
const ActiveScoreboard = () => {
|
const ActiveScoreboard = () => {
|
||||||
const pageRef = useRef();
|
const pageRef = useRef(null);
|
||||||
const headingRef = useRef();
|
const headingRef = useRef(null);
|
||||||
const router = useIonRouter();
|
const router = useIonRouter();
|
||||||
|
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
@@ -33,7 +33,7 @@ import { getActiveScoreboard } from '../store/Selectors';
|
|||||||
import './Page.css';
|
import './Page.css';
|
||||||
|
|
||||||
const Dashboard = () => {
|
const Dashboard = () => {
|
||||||
const pageRef = useRef();
|
const pageRef = useRef(null);
|
||||||
const router = useIonRouter();
|
const router = useIonRouter();
|
||||||
|
|
||||||
const activeScoreboard = useStoreState(MainStore, getActiveScoreboard);
|
const activeScoreboard = useStoreState(MainStore, getActiveScoreboard);
|
||||||
|
@@ -1,4 +1,21 @@
|
|||||||
import { IonButton, IonButtons, IonCard, IonCardContent, IonCardSubtitle, IonCol, IonContent, IonHeader, IonIcon, IonLabel, IonMenuButton, IonPage, IonRow, IonText, IonTitle, IonToolbar } from '@ionic/react';
|
import {
|
||||||
|
IonButton,
|
||||||
|
IonButtons,
|
||||||
|
IonCard,
|
||||||
|
IonCardContent,
|
||||||
|
IonCardSubtitle,
|
||||||
|
IonCol,
|
||||||
|
IonContent,
|
||||||
|
IonHeader,
|
||||||
|
IonIcon,
|
||||||
|
IonLabel,
|
||||||
|
IonMenuButton,
|
||||||
|
IonPage,
|
||||||
|
IonRow,
|
||||||
|
IonText,
|
||||||
|
IonTitle,
|
||||||
|
IonToolbar,
|
||||||
|
} from '@ionic/react';
|
||||||
import { arrowForward } from 'ionicons/icons';
|
import { arrowForward } from 'ionicons/icons';
|
||||||
import { useStoreState } from 'pullstate';
|
import { useStoreState } from 'pullstate';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
@@ -8,12 +25,11 @@ import { getScoreboards } from '../store/Selectors';
|
|||||||
import './Page.css';
|
import './Page.css';
|
||||||
|
|
||||||
const PreviousScoreboards = () => {
|
const PreviousScoreboards = () => {
|
||||||
|
const pageRef = useRef(null);
|
||||||
const pageRef = useRef();
|
const scoreboards = useStoreState(MainStore, getScoreboards);
|
||||||
const scoreboards = useStoreState(MainStore, getScoreboards)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IonPage ref={ pageRef }>
|
<IonPage ref={pageRef}>
|
||||||
<IonHeader>
|
<IonHeader>
|
||||||
<IonToolbar>
|
<IonToolbar>
|
||||||
<IonButtons slot="start">
|
<IonButtons slot="start">
|
||||||
@@ -30,33 +46,37 @@ const PreviousScoreboards = () => {
|
|||||||
</IonToolbar>
|
</IonToolbar>
|
||||||
</IonHeader>
|
</IonHeader>
|
||||||
|
|
||||||
{ scoreboards.length > 0 &&
|
{scoreboards.length > 0 && (
|
||||||
|
|
||||||
<>
|
<>
|
||||||
{ scoreboards.map((scoreboard, index) => {
|
{scoreboards.map((scoreboard, index) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<IonCard
|
||||||
<IonCard key={ index } className="animate__animated animate__slideInLeft active-scoreboard-card">
|
key={index}
|
||||||
|
className="animate__animated animate__slideInLeft active-scoreboard-card"
|
||||||
|
>
|
||||||
<IonCardContent>
|
<IonCardContent>
|
||||||
<IonRow>
|
<IonRow>
|
||||||
<IonCol size="6">
|
<IonCol size="6">
|
||||||
<IonCardSubtitle color="light">Title</IonCardSubtitle>
|
<IonCardSubtitle color="light">Title</IonCardSubtitle>
|
||||||
<IonText color="light">
|
<IonText color="light">
|
||||||
<p className="ion-text-wrap">{ scoreboard.title }</p>
|
<p className="ion-text-wrap">{scoreboard.title}</p>
|
||||||
</IonText>
|
</IonText>
|
||||||
</IonCol>
|
</IonCol>
|
||||||
|
|
||||||
<IonCol size="3" className="ion-text-center">
|
<IonCol size="3" className="ion-text-center">
|
||||||
<IonCardSubtitle color="light">Players</IonCardSubtitle>
|
<IonCardSubtitle color="light">Players</IonCardSubtitle>
|
||||||
<IonText color="light">
|
<IonText color="light">
|
||||||
<p>{ scoreboard.players && scoreboard.players.length }</p>
|
<p>{scoreboard.players && scoreboard.players.length}</p>
|
||||||
</IonText>
|
</IonText>
|
||||||
</IonCol>
|
</IonCol>
|
||||||
|
|
||||||
<IonCol size="2">
|
<IonCol size="2">
|
||||||
<IonButton color="light" fill="outline" routerLink={ `/page/active-scoreboard/${ scoreboard.id }`}>
|
<IonButton
|
||||||
<IonIcon icon={ arrowForward } />
|
color="light"
|
||||||
|
fill="outline"
|
||||||
|
routerLink={`/page/active-scoreboard/${scoreboard.id}`}
|
||||||
|
>
|
||||||
|
<IonIcon icon={arrowForward} />
|
||||||
</IonButton>
|
</IonButton>
|
||||||
</IonCol>
|
</IonCol>
|
||||||
</IonRow>
|
</IonRow>
|
||||||
@@ -65,19 +85,26 @@ const PreviousScoreboards = () => {
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</>
|
</>
|
||||||
}
|
)}
|
||||||
|
|
||||||
{ scoreboards.length < 1 &&
|
{scoreboards.length < 1 && (
|
||||||
<IonRow>
|
<IonRow>
|
||||||
<IonCol size="12" className="ion-text-center">
|
<IonCol size="12" className="ion-text-center">
|
||||||
<IonLabel color="primary">
|
<IonLabel color="primary">
|
||||||
<h1>No scoreboards to show</h1>
|
<h1>No scoreboards to show</h1>
|
||||||
<p>You can easily add a new one</p>
|
<p>You can easily add a new one</p>
|
||||||
</IonLabel>
|
</IonLabel>
|
||||||
<IonButton className="ion-margin-top" color="primary" fill="outline" routerLink="/page/Dashboard">Add one →</IonButton>
|
<IonButton
|
||||||
|
className="ion-margin-top"
|
||||||
|
color="primary"
|
||||||
|
fill="outline"
|
||||||
|
routerLink="/page/Dashboard"
|
||||||
|
>
|
||||||
|
Add one →
|
||||||
|
</IonButton>
|
||||||
</IonCol>
|
</IonCol>
|
||||||
</IonRow>
|
</IonRow>
|
||||||
}
|
)}
|
||||||
</IonContent>
|
</IonContent>
|
||||||
</IonPage>
|
</IonPage>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user