|
|
|
|
@ -1,6 +1,21 @@
|
|
|
|
|
import { IonContent, IonItem, IonLabel, IonList, IonListHeader } from '@ionic/react';
|
|
|
|
|
import React from 'react';
|
|
|
|
|
import {
|
|
|
|
|
IonContent,
|
|
|
|
|
IonFabButton,
|
|
|
|
|
IonInput,
|
|
|
|
|
IonItem,
|
|
|
|
|
IonLabel,
|
|
|
|
|
IonList,
|
|
|
|
|
IonListHeader,
|
|
|
|
|
IonToolbar,
|
|
|
|
|
IonIcon,
|
|
|
|
|
IonRow,
|
|
|
|
|
IonCol,
|
|
|
|
|
IonToast,
|
|
|
|
|
} from '@ionic/react';
|
|
|
|
|
import React, { useState, useRef } from 'react';
|
|
|
|
|
import './OnlineList.css';
|
|
|
|
|
import { clipboardOutline } from 'ionicons/icons';
|
|
|
|
|
import copy from 'copy-to-clipboard';
|
|
|
|
|
|
|
|
|
|
type OnlineListProps = {
|
|
|
|
|
pane: string;
|
|
|
|
|
@ -8,6 +23,14 @@ type OnlineListProps = {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const OnlineList: React.FC<OnlineListProps> = ({ pane, userList }) => {
|
|
|
|
|
const inputRef = useRef<HTMLIonInputElement>(null);
|
|
|
|
|
const [showToast, setShowToast] = useState(false);
|
|
|
|
|
|
|
|
|
|
const copyLink = () => {
|
|
|
|
|
copy(window.location.href);
|
|
|
|
|
setShowToast(true);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<IonContent style={{ display: pane === 'online' ? null : 'none' }} class="online-content">
|
|
|
|
|
<IonListHeader class="online-header">Online</IonListHeader>
|
|
|
|
|
@ -20,6 +43,24 @@ const OnlineList: React.FC<OnlineListProps> = ({ pane, userList }) => {
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</IonList>
|
|
|
|
|
<IonRow>
|
|
|
|
|
<IonCol class="clipboard-col">
|
|
|
|
|
<IonListHeader class="online-header">Invite friends!</IonListHeader>
|
|
|
|
|
<IonToolbar class="clipboard-toolbar">
|
|
|
|
|
<IonInput readonly value={window.location.href} ref={inputRef} class="clipboard-input"></IonInput>
|
|
|
|
|
<IonFabButton slot="end" size="small" onClick={copyLink} class="send-button">
|
|
|
|
|
<IonIcon icon={clipboardOutline}></IonIcon>
|
|
|
|
|
</IonFabButton>
|
|
|
|
|
</IonToolbar>
|
|
|
|
|
</IonCol>
|
|
|
|
|
</IonRow>
|
|
|
|
|
<IonToast
|
|
|
|
|
isOpen={showToast}
|
|
|
|
|
onDidDismiss={() => setShowToast(false)}
|
|
|
|
|
message="Room link copied"
|
|
|
|
|
color="primary"
|
|
|
|
|
duration={2000}
|
|
|
|
|
></IonToast>
|
|
|
|
|
</IonContent>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|