Skip to content

Commit

Permalink
Removed unused interface.
Browse files Browse the repository at this point in the history
  • Loading branch information
inbarbarkai committed May 15, 2022
1 parent 10d5636 commit 171ea36
Showing 1 changed file with 73 additions and 87 deletions.
160 changes: 73 additions & 87 deletions web/src/components/user/userInvitations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,94 +3,80 @@ import * as React from 'react';
import { Invitation } from '../../models/invitation';
import Moment from 'react-moment';

export function UserInvitations() {
let userInvitations: Invitation[] = [
{
invitationId: 'asdf',
userId: 'asdf',
inviteesAmount: 3,
inviteesAdmitted: 2,
inviteesArrivalTimestamp: new Date(),
isActive: true,
creationTimestamp: new Date(),
modifyTimestamp: new Date(),
commentForGuard: 'hey'
}
];


export function UserInvitations() {
let userInvitations:Invitation[] = [
{invitationId: 'asdf',
userId: 'asdf',
inviteesAmount: 3,
inviteesAdmitted:2,
inviteesArrivalTimestamp: new Date(),
isActive: true,
creationTimestamp: new Date(),
modifyTimestamp: new Date(),
commentForGuard: 'hey'}
];

const renderRows = function(){ return userInvitations.map((invitation) => <InvitaionRow invitation={invitation}/>)
}
return (
<table>
<thead>
<tr>
<th>
addmitted
</th>
<th>
invited
</th>
<th>
arriving at
</th>
<th>
comment for guard
</th>
<th>
created at
</th>
<th>
is active
</th>
</tr>
</thead>
<tbody>

{renderRows()}
</tbody>
</table>
);

}

function InvitaionRow({invitation}:IInvitaionRowData){
return (
<tr>
<td>
{invitation.inviteesAdmitted}
</td>
<td>
{invitation.inviteesAmount}
</td>
<td>
<Moment format="MM/DD HH:mm" date= {invitation.inviteesArrivalTimestamp}>

</Moment>
</td>
<td>
{invitation.commentForGuard}
</td>
<td>
<Moment format="MM/DD HH:mm" date= { invitation.creationTimestamp}>

</Moment>
</td>
<td>
{invitation.isActive.toString()}
</td>
</tr>
);
}


function InvitaionRows({invitations}:IInvitaionRowsData){
return invitations.map((invitation) => <InvitaionRow invitation={invitation}/>)
const renderRows = function () {
return userInvitations.map((invitation) => <InvitaionRow invitation={invitation} />)
}
return (
<table>
<thead>
<tr>
<th>
addmitted
</th>
<th>
invited
</th>
<th>
arriving at
</th>
<th>
comment for guard
</th>
<th>
created at
</th>
<th>
is active
</th>
</tr>
</thead>
<tbody>
{renderRows()}
</tbody>
</table>
);
}

interface IInvitaionRowData{
invitation: Invitation
}
function InvitaionRow({ invitation }: IInvitaionRowData) {
return (
<tr>
<td>
{invitation.inviteesAdmitted}
</td>
<td>
{invitation.inviteesAmount}
</td>
<td>
<Moment format="MM/DD HH:mm" date={invitation.inviteesArrivalTimestamp} />
</td>
<td>
{invitation.commentForGuard}
</td>
<td>
<Moment format="MM/DD HH:mm" date={invitation.creationTimestamp} />
</td>
<td>
{invitation.isActive.toString()}
</td>
</tr>
);
}

interface IInvitaionRowsData{
invitations: Invitation[]
}
interface IInvitaionRowData {
invitation: Invitation
}

0 comments on commit 171ea36

Please sign in to comment.