Commit 1aab720a authored by Patrik Kotucek's avatar Patrik Kotucek
Browse files

feat: change in fragments and styling

parent 639bf185
Loading
Loading
Loading
Loading
+0 −38
Original line number Diff line number Diff line
import { Tag } from '@blueprintjs/core'
import { css, cx } from '@emotion/css'
import type { ITodoLogActionLog } from '@inject/graphql'
import { useTranslationFrontend } from '@inject/locale'
import type { FC } from 'react'

export const EmailRecipientsTag: FC<{
  actionLog: ITodoLogActionLog
  className?: string
}> = ({ actionLog, className }) => {
  const { t } = useTranslationFrontend()
  if (actionLog.details.__typename !== 'IEmailType') {
    return null
  }
  const { sender } = actionLog.details

  const recipients = actionLog.details.thread.participants.filter(
    participant => participant.address !== sender.address
  )

  return (
    <Tag
      className={cx(
        css`
          margin-right: 0.25rem;
          display: inline-flex;
          align-items: center;
          vertical-align: middle;
        `,
        className
      )}
      round
      icon='envelope'
    >
      {t('overview.todoList.email.recipients', { count: recipients.length })}
    </Tag>
  )
}
+15 −7
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import { InstructorToolChannelActionLogRoute } from '../../routes/_protected/ins
import { InstructorEmailThreadPageRoute } from '../../routes/_protected/instructor/$exerciseId/$teamId/email/$tab/$threadId'
import { canBeReviewed, getIcon } from '../../utils'
import { QuestionnaireStatus } from '../InstructorQuestionnaire/QuestionnaireStatus'
import { EmailRecipientsTag } from './EmailRecipientsTag'
import { OverviewPillNav } from './OverviewPillNav'

const recipientRow = css`
@@ -316,14 +315,24 @@ const EmailLogItemContent: FC<{
          <div key={recipient.address} className={recipientRow}>
            <div className={recipientAddress}>{recipient.address}</div>
            <div className={recipientMeta}>
              <Tag minimal>{`${t('overview.todoList.email.templates', {
              <Tag minimal>
                {t(
                  recipient.templateCount === 0
                    ? 'overview.todoList.email.noTemplates'
                    : recipient.templateCount === 1
                      ? 'overview.todoList.email.template'
                      : 'overview.todoList.email.templates',
                  {
                    count: recipient.templateCount,
              })}`}</Tag>
                  }
                )}
              </Tag>
              {recipient.totalMilestonesCount !== undefined && (
                <Tag minimal intent='primary'>{`${t(
                  'overview.todoList.email.milestones',
                  recipient.totalMilestonesCount === 1
                    ? 'overview.todoList.email.milestone'
                    : 'overview.todoList.email.milestones',
                  {
                    count: recipient.pendingMilestonesCount,
                    total: recipient.totalMilestonesCount,
                  }
                )}`}</Tag>
@@ -467,7 +476,6 @@ const LogItem: FC<LogItemProps> = ({
        </h5>
        <div className={topMetaRow}>
          <OverviewPillNav actionLog={actionLog} />
          <EmailRecipientsTag actionLog={actionLog} />
          <Timestamp
            formatTimestampProps={{
              timestamp: actionLog.timestamp,
+5 −2
Original line number Diff line number Diff line
@@ -1204,7 +1204,10 @@ export const ITodoLogActionLog = graphql(
                id
                description
                templates {
                  ...EmailTemplate
                  id
                  control {
                    ...Control
                  }
                }
              }
            }
@@ -1263,7 +1266,7 @@ export const ITodoLogActionLog = graphql(
      }
    }
  `,
  [EmailTemplate]
  [Control]
)
// just a wrapper around ITodoLogActionLog
export const TodoLogActionLog = graphql(
+5 −2
Original line number Diff line number Diff line
@@ -516,8 +516,11 @@
      "notFoundTitle": "Žádné injecty",
      "notFoundDescription": "Nebyly nalezeny žádné injecty, které by mohly být zobrazeny v téhle kategorii. Prosím počkejte na nové",
      "email": {
        "templates": "Šablony: {{count}}",
        "milestones": "Milníky: {{count}}/{{total}}",
        "templates": "{{count}} šablon",
        "template": "1 šablona",
        "noTemplates": "Bez šablon",
        "milestones": "{{total}} Milníky",
        "milestone": "1 milník",
        "recipients": "Příjemci: {{count}}"
      }
    },
+5 −2
Original line number Diff line number Diff line
@@ -516,8 +516,11 @@
      "notFoundTitle": "No inject items",
      "notFoundDescription": "There are no log items that can be shown in this category. Please await for new injects",
      "email": {
        "templates": "Templates: {{count}}",
        "milestones": "Milestones: {{count}}/{{total}}",
        "templates": "{{count}} templates",
        "template": "1 template",
        "noTemplates": "No templates",
        "milestones": "{{total}} milestones",
        "milestone": "1 milestone",
        "recipients": "Recipients: {{count}}"
      }
    },