diff --git a/webclient/src/Admin.js b/webclient/src/Admin.js index d6ba6b6..16ff8da 100644 --- a/webclient/src/Admin.js +++ b/webclient/src/Admin.js @@ -3,7 +3,7 @@ import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } f import './light.css'; import { Button, Container, Checkbox, Dimmer, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; import moment from 'moment'; -import { BasicTable, staticUrl, requester } from './utils.js'; +import { statusColor, BasicTable, staticUrl, requester } from './utils.js'; import { TransactionList, TransactionEditor } from './Transactions.js'; export function AdminTransactions(props) { @@ -473,7 +473,10 @@ export function AdminMemberInfo(props) { Status: - {member.status} + + + {member.status || 'Unknown'} + diff --git a/webclient/src/Home.js b/webclient/src/Home.js index 693baa0..8da43f3 100644 --- a/webclient/src/Home.js +++ b/webclient/src/Home.js @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; import './light.css'; import { Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; -import { BasicTable, staticUrl, requester } from './utils.js'; +import { statusColor, BasicTable, staticUrl, requester } from './utils.js'; import { LoginForm, SignupForm } from './LoginSignup.js'; import { AccountForm } from './Account.js'; @@ -24,18 +24,16 @@ function MemberInfo(props) { -
- - - - {member.preferred_name} {member.last_name} -
+
{member.preferred_name} {member.last_name}
Status: - {member.status || 'Unknown'} + + + {member.status || 'Unknown'} + Expiry: diff --git a/webclient/src/Members.js b/webclient/src/Members.js index e536a89..f6d4afa 100644 --- a/webclient/src/Members.js +++ b/webclient/src/Members.js @@ -2,7 +2,7 @@ import React, { useState, useEffect, useReducer } from 'react'; import { BrowserRouter as Router, Switch, Route, Link, useParams } from 'react-router-dom'; import './light.css'; import { Button, Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Input, Item, Menu, Message, Segment, Table } from 'semantic-ui-react'; -import { isAdmin, BasicTable, staticUrl, requester } from './utils.js'; +import { statusColor, isAdmin, BasicTable, staticUrl, requester } from './utils.js'; import { NotFound, PleaseLogin } from './Misc.js'; import { AdminMemberInfo, AdminMemberPause, AdminMemberForm, AdminMemberCards, AdminTransactions } from './Admin.js'; @@ -54,7 +54,10 @@ export function Members(props) { - {x.member.preferred_name} {x.member.last_name} + + + {x.member.preferred_name} {x.member.last_name} + Status: {x.member.status || 'Unknown'} Joined: {x.member.current_start_date || 'Unknown'} @@ -112,7 +115,10 @@ export function MemberDetail(props) { Status: - {member.status || 'Unknown'} + + + {member.status || 'Unknown'} + Joined: diff --git a/webclient/src/utils.js b/webclient/src/utils.js index 82ed3d8..9168d08 100644 --- a/webclient/src/utils.js +++ b/webclient/src/utils.js @@ -1,13 +1,20 @@ import React, { useState, useEffect } from 'react'; import { Table } from 'semantic-ui-react'; -export const isAdmin = (user) => user.is_staff || user.member.is_director || user.member.is_staff; -export const isInstructor = (user) => isAdmin(user) || user.member.is_instructor; - export const siteUrl = window.location.protocol + '//' + window.location.hostname; export const apiUrl = window.location.protocol + '//api.' + window.location.hostname; export const staticUrl = window.location.protocol + '//static.' + window.location.hostname; +export const isAdmin = (user) => user.is_staff || user.member.is_director || user.member.is_staff; +export const isInstructor = (user) => isAdmin(user) || user.member.is_instructor; + +export const statusColor = { + 'Current': 'green', + 'Due': 'yellow', + 'Overdue': 'red', + 'Former Member': 'black', +}; + export const BasicTable = (props) => ( {props.children}