@@ -4,6 +4,8 @@ import moment from 'moment'
44import copy from 'copy-to-clipboard'
55import jwt from 'jsonwebtoken'
66import { Copy } from '@styled-icons/boxicons-regular/Copy'
7+ import { Check } from '@styled-icons/boxicons-regular/Check'
8+ import { X } from '@styled-icons/boxicons-regular/X'
79import { withAuthServerSideProps } from '../utils/withAuth'
810import SEO from '../components/SEO'
911import Box from '../components/Box'
@@ -117,8 +119,7 @@ const Account = ({ token, invites = [], user, userRole }) => {
117119 < Box
118120 display = "flex"
119121 alignItems = "center"
120- border = "1px solid"
121- borderColor = "border"
122+ bg = "sidebar"
122123 borderRadius = { 1 }
123124 p = { 2 }
124125 pl = { 4 }
@@ -140,32 +141,24 @@ const Account = ({ token, invites = [], user, userRole }) => {
140141 {
141142 header : 'Email' ,
142143 accessor : 'email' ,
143- cell : ( { value, row } ) => (
144- < Text
145- _css = { {
146- textDecoration : row . claimed ? 'line-through' : 'none' ,
147- } }
148- >
149- { value }
150- </ Text >
151- ) ,
144+ cell : ( { value } ) => < Text > { value } </ Text > ,
152145 gridWidth : '1.75fr' ,
153146 } ,
154147 {
155148 header : 'Claimed' ,
156149 accessor : 'claimed' ,
157- cell : ( { value } ) => < Text > { value ? 'Yes' : 'No' } </ Text > ,
150+ cell : ( { value } ) => (
151+ < Box color = { value ? 'success' : 'grey' } >
152+ { value ? < Check size = { 24 } /> : < X size = { 24 } /> } { ' ' }
153+ </ Box >
154+ ) ,
158155 gridWidth : '0.5fr' ,
159156 } ,
160157 {
161158 header : 'Valid until' ,
162159 accessor : 'validUntil' ,
163160 cell : ( { value } ) => (
164- < Text
165- _css = { {
166- textDecoration : value < Date . now ( ) ? 'line-through' : 'none' ,
167- } }
168- >
161+ < Text color = { value < Date . now ( ) ? 'error' : 'text' } >
169162 { moment ( value ) . format ( 'HH:mm Do MMM YYYY' ) }
170163 </ Text >
171164 ) ,
@@ -179,14 +172,18 @@ const Account = ({ token, invites = [], user, userRole }) => {
179172 ) ,
180173 gridWidth : '1.2fr' ,
181174 } ,
182- {
183- header : 'Role' ,
184- accessor : 'role' ,
185- cell : ( { value } ) => (
186- < Text _css = { { textTransform : 'capitalize' } } > { value } </ Text >
187- ) ,
188- gridWidth : '0.6fr' ,
189- } ,
175+ ...( userRole === 'admin'
176+ ? [
177+ {
178+ header : 'Role' ,
179+ accessor : 'role' ,
180+ cell : ( { value } ) => (
181+ < Text _css = { { textTransform : 'capitalize' } } > { value } </ Text >
182+ ) ,
183+ gridWidth : '0.6fr' ,
184+ } ,
185+ ]
186+ : [ ] ) ,
190187 {
191188 header : 'Copy link' ,
192189 cell : ( { row } ) => {
@@ -202,7 +199,7 @@ const Account = ({ token, invites = [], user, userRole }) => {
202199 'Invite link copied to clipboard'
203200 )
204201 } }
205- disabled = { row . claimed }
202+ disabled = { row . claimed || row . validUntil < Date . now ( ) }
206203 px = { 1 }
207204 py = { 1 }
208205 >
0 commit comments