Skip to content

Commit

Permalink
Revert "wip"
Browse files Browse the repository at this point in the history
This reverts commit 8458874.
  • Loading branch information
haworku committed Apr 18, 2024
1 parent edf3656 commit adeab37
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 166 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import React from 'react'
import { Loading } from '../../../components'
import {
EmailConfiguration,
StateAnalystsConfiguration,
useFetchEmailSettingsQuery,
} from '../../../gen/gqlClient'
import { SettingsErrorAlert } from '../SettingsErrorAlert'
import styles from '../Settings.module.scss'
import { EmailAnalystsTable } from './EmailAnalystsTable'

const formatEmails = (arr?: string[]) => (arr ? arr.join(',') : 'NOT DEFINED')

const EmailSettingsTable = ({
export const EmailSettingsTable = ({
type,
}: {
type: 'GENERAL' | 'ANALYSTS' | 'SUPPORT'
Expand All @@ -26,20 +26,20 @@ const EmailSettingsTable = ({
{loading && <Loading />}

{data && config && type === 'GENERAL' && (
<EmailGeneralTable config={config} />
<EmailsGeneralTable config={config} />
)}

{data && analysts && type === 'ANALYSTS' && (
<EmailAnalystsTable analysts={analysts} />
<EmailsAnalystsTable analysts={analysts} />
)}
{data && config && type === 'SUPPORT' && (
<EmailSupportTable config={config} />
<EmailsSupportTable config={config} />
)}
</div>
)
}

const EmailGeneralTable = ({ config }: { config: EmailConfiguration }) => {
const EmailsGeneralTable = ({ config }: { config: EmailConfiguration }) => {
console.info('ALL CONFIG', JSON.stringify(config))
return (
<>
Expand Down Expand Up @@ -98,7 +98,45 @@ const EmailGeneralTable = ({ config }: { config: EmailConfiguration }) => {
)
}

const EmailSupportTable = ({ config }: { config: EmailConfiguration }) => {
const EmailsAnalystsTable = ({
analysts,
}: {
analysts: StateAnalystsConfiguration[]
}) => {
return (
<>
<h2>State Analyst emails</h2>
<p>
State analysts email settings. Currently a standalone
configuration based on the state programs spreadsheet.
</p>
<Table bordered>
<caption className="srOnly">Analyst emails</caption>
<thead>
<tr>
<th>Inbox</th>
<th>State</th>
</tr>
</thead>
<tbody>
{analysts &&
analysts.map((analyst, index) => {
return (
<tr key={index}>
<td>
{formatEmails(analyst.emails || [])}
</td>
<td>{analyst.stateCode}</td>
</tr>
)
})}
</tbody>
</Table>
</>
)
}

const EmailsSupportTable = ({ config }: { config: EmailConfiguration }) => {
return (
<>
<h2>Support emails</h2>
Expand Down Expand Up @@ -138,5 +176,3 @@ const EmailSupportTable = ({ config }: { config: EmailConfiguration }) => {
</>
)
}

export {EmailSettingsTable, formatEmails}
4 changes: 0 additions & 4 deletions services/app-web/src/pages/Settings/Settings.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
border-left: 0;
border-right: 0;
}
td {
word-wrap: break-word;
overflow-wrap: break-word;
}
}

table {
Expand Down

0 comments on commit adeab37

Please sign in to comment.