Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into new-multiple-choice…
Browse files Browse the repository at this point in the history
…-grading-policy
  • Loading branch information
Maija Y committed Oct 2, 2023
2 parents 527992a + 21ccb6e commit 057e1b4
Show file tree
Hide file tree
Showing 166 changed files with 122 additions and 137 deletions.
43 changes: 25 additions & 18 deletions services/cms/src/blocks/ExerciseTask/ExerciseTaskEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { css, cx } from "@emotion/css"
import styled from "@emotion/styled"
import { faPenSquare, faTrashAlt, faWindowClose } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { PencilBox, Trash, XmarkCircle } from "@vectopus/atlas-icons-react"
import { InnerBlocks } from "@wordpress/block-editor"
import { BlockEditProps } from "@wordpress/blocks"
import React, { useContext, useState } from "react"
Expand Down Expand Up @@ -56,20 +55,6 @@ const gray500WithHover = css`
}
`

// eslint-disable-next-line i18next/no-literal-string
const StyledIconDark = styled(FontAwesomeIcon)`
font-size: 1rem;
color: ${baseTheme.colors.gray[700]};
margin: 1.5rem;
`

// eslint-disable-next-line i18next/no-literal-string
const StyledIconLight = styled(FontAwesomeIcon)`
font-size: 1rem;
color: ${baseTheme.colors.gray[100]};
margin: 1.5rem;
`

export interface ExerciseTaskAttributes {
id: string
exercise_type: string
Expand Down Expand Up @@ -155,7 +140,23 @@ const ExerciseTaskEditor: React.FC<
tabIndex={0}
aria-label={attributes.show_editor ? t("close") : t("edit")}
>
<StyledIconLight icon={attributes.show_editor ? faWindowClose : faPenSquare} />
{attributes.show_editor ? (
<XmarkCircle
size={16}
className={css`
color: ${baseTheme.colors.gray[100]};
margin: 1.5rem;
`}
/>
) : (
<PencilBox
size={16}
className={css`
color: ${baseTheme.colors.gray[100]};
margin: 1.5rem;
`}
/>
)}
</div>
<div
className={cx(svgSquare, gray400WithHover)}
Expand All @@ -165,7 +166,13 @@ const ExerciseTaskEditor: React.FC<
tabIndex={0}
aria-label={t("delete")}
>
<StyledIconDark icon={faTrashAlt} />
<Trash
size={16}
className={css`
color: ${baseTheme.colors.gray[700]};
margin: 1.5rem;
`}
/>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions services/cms/src/components/editors/EmailEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SaveIcon from "@mui/icons-material/Save"
import LoadingButton from "@mui/lab/LoadingButton"
import { FloppyDiskSave } from "@vectopus/atlas-icons-react"
import { BlockInstance } from "@wordpress/blocks"
import dynamic from "next/dynamic"
import React, { useContext, useState } from "react"
Expand Down Expand Up @@ -79,7 +79,7 @@ const EmailEditor: React.FC<React.PropsWithChildren<EmailEditorProps>> = ({
<LoadingButton
// eslint-disable-next-line i18next/no-literal-string
loadingPosition="start"
startIcon={<SaveIcon />}
startIcon={<FloppyDiskSave size={15} />}
loading={saving}
onClick={handleOnSave}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SaveIcon from "@mui/icons-material/Save"
import LoadingButton from "@mui/lab/LoadingButton"
import { FloppyDiskSave } from "@vectopus/atlas-icons-react"
import { BlockInstance } from "@wordpress/blocks"
import dynamic from "next/dynamic"
import React, { useState } from "react"
Expand Down Expand Up @@ -68,7 +68,7 @@ const ExamsInstructionsEditor: React.FC<React.PropsWithChildren<ExamsInstruction
<LoadingButton
// eslint-disable-next-line i18next/no-literal-string
loadingPosition="start"
startIcon={<SaveIcon />}
startIcon={<FloppyDiskSave size={15} />}
loading={saving}
onClick={handleOnSave}
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { css } from "@emotion/css"
import { faCircleInfo as infoIcon } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { InfoCircle } from "@vectopus/atlas-icons-react"
import React, { useContext } from "react"
import { useTranslation } from "react-i18next"

Expand Down Expand Up @@ -90,7 +89,7 @@ const ExerciseTask: React.FC<React.PropsWithChildren<ExerciseTaskProps>> = ({
}
`}
>
<FontAwesomeIcon icon={infoIcon} />
<InfoCircle size={20} />
{feedbackText}
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styled from "@emotion/styled"
import { faQuestion as infoIcon } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { useQuery, useQueryClient } from "@tanstack/react-query"
import CheckIcon from "humbleicons/icons/check.svg"
import { CheckCircle } from "@vectopus/atlas-icons-react"
import { produce } from "immer"
import { useContext, useId, useReducer, useState } from "react"
import { useTranslation } from "react-i18next"
Expand Down Expand Up @@ -474,16 +474,17 @@ const ExerciseBlock: React.FC<
padding: 0.7rem 1rem;
margin: 1rem 0;
border: 1px solid ${baseTheme.colors.green[300]};
display: flex;
align-items: center;
svg {
width: 80px;
margin-right: 1rem;
}
`}
>
<CheckIcon />
<CheckCircle size={30} />

<div>{t("exam-submission-has-been-saved-help-text")}</div>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { css } from "@emotion/css"
import styled from "@emotion/styled"
import { faArrowLeft, faArrowRight } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { ArrowLeft, ArrowRight } from "@vectopus/atlas-icons-react"
import { maxBy, minBy } from "lodash"
import { useCallback, useContext, useEffect, useRef, useState } from "react"
import { useTranslation } from "react-i18next"
Expand Down Expand Up @@ -341,7 +340,11 @@ const HeadingsNavigation: React.FC<React.PropsWithChildren<HeadingsNavigationPro
}
`}
>
<FontAwesomeIcon icon={realCollapsed ? faArrowLeft : faArrowRight} />
{realCollapsed ? (
<ArrowLeft size={16} weight="bold" />
) : (
<ArrowRight size={16} weight="bold" />
)}
</button>
</>
)
Expand Down
31 changes: 14 additions & 17 deletions services/course-material/src/components/SearchDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { css, cx } from "@emotion/css"
import styled from "@emotion/styled"
import { faXmark as closeIcon, faSearch } from "@fortawesome/free-solid-svg-icons"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { MagnifyingGlass, XmarkCircle } from "@vectopus/atlas-icons-react"
import Link from "next/link"
import React, { useEffect, useMemo, useState } from "react"
import { useTranslation } from "react-i18next"
Expand Down Expand Up @@ -31,6 +30,8 @@ const HeaderBar = styled.div`
`

const StyledIcon = css`
right: -8px;
bottom: -2px;
:hover {
cursor: pointer;
}
Expand Down Expand Up @@ -106,24 +107,20 @@ const SearchDialog: React.FC<React.PropsWithChildren<SearchDialogProps>> = ({
setOpen(true)
}

const openModalOnEnter = (event: React.KeyboardEvent<SVGSVGElement>) => {
if (event.key == "Enter") {
setOpen(true)
}
}

return (
<>
<FontAwesomeIcon
<Button
tabIndex={0}
id="search-for-pages-button"
className={cx(StyledIcon)}
icon={faSearch}
aria-label={t("button-label-search-for-pages")}
aria-hidden={false}
size="small"
variant="icon"
onClick={openModal}
onKeyPress={openModalOnEnter}
/>
>
<MagnifyingGlass size={16} weight="bold" />
</Button>
<Dialog open={open} onClose={closeModal} noPadding aria-labelledby="search-for-pages-button">
<div
className={css`
Expand All @@ -138,18 +135,18 @@ const SearchDialog: React.FC<React.PropsWithChildren<SearchDialogProps>> = ({
`}
>
<HeaderBar>
<FontAwesomeIcon
<MagnifyingGlass
weight="bold"
className={css`
margin-right: -23px;
z-index: 2;
font-size: 22px;
position: relative;
right: -9px;
right: -8px;
color: ${baseTheme.colors.gray[400]};
`}
icon={faSearch}
aria-label={t("button-label-search-for-pages")}
/>

<input
className={css`
display: flex;
Expand Down Expand Up @@ -184,7 +181,7 @@ const SearchDialog: React.FC<React.PropsWithChildren<SearchDialogProps>> = ({
aria-label={t("close")}
onClick={closeModal}
>
<FontAwesomeIcon icon={closeIcon} />
<XmarkCircle />
</Button>
</HeaderBar>
<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
use anyhow::Result;
use bytes::Bytes;
/*
use futures::TryStreamExt;
use headless_lms_models::exercise_task_submissions; */
use headless_lms_models::course_instances;

use async_trait::async_trait;
Expand Down Expand Up @@ -47,7 +44,7 @@ impl CsvExportDataLoader for CompletionsExportOperation {
}
}

/// Writes the submissions as csv into the writer
/// Writes the completions as csv into the writer
pub async fn export_completions<W>(
conn: &mut PgConnection,
course_instance_id: Uuid,
Expand Down Expand Up @@ -161,8 +158,8 @@ where
for next in course_instances.into_iter() {
let csv_row = vec![
next.id.to_string(),
next.created_at.to_string(),
next.updated_at.to_string(),
next.created_at.to_rfc3339(),
next.updated_at.to_rfc3339(),
next.name.unwrap_or_default(),
];
writer.write_record(csv_row);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ where
while let Some(next) = stream.try_next().await? {
let csv_row = vec![
next.id.to_string(),
next.created_at.to_string(),
next.updated_at.to_string(),
next.created_at.to_rfc3339(),
next.updated_at.to_rfc3339(),
next.exercise_type.to_string(),
next.private_spec
.map(|o| o.to_string())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
let csv_row = vec![
next.id.to_string(),
next.user_id.to_string(),
next.created_at.to_string(),
next.created_at.to_rfc3339(),
next.exercise_id.to_string(),
next.exercise_task_id.to_string(),
next.score_given.unwrap_or(0.0).to_string(),
Expand All @@ -97,7 +97,7 @@ impl CsvExportDataLoader for CourseSubmissionExportOperation {
conn: &mut PgConnection,
token: AuthorizationToken,
) -> anyhow::Result<CSVExportAdapter> {
export_course_submissions(
export_course_exercise_task_submissions(
&mut *conn,
self.course_id,
CSVExportAdapter {
Expand All @@ -110,7 +110,7 @@ impl CsvExportDataLoader for CourseSubmissionExportOperation {
}

/// Writes the course submissions as csv into the writer
pub async fn export_course_submissions<W>(
pub async fn export_course_exercise_task_submissions<W>(
conn: &mut PgConnection,
course_id: Uuid,
writer: W,
Expand All @@ -120,7 +120,7 @@ where
{
let headers = IntoIterator::into_iter([
"exercise_slide_submission_id".to_string(),
"id".to_string(),
"exercise_task_submission_id".to_string(),
"user_id".to_string(),
"created_at".to_string(),
"course_instance_id".to_string(),
Expand All @@ -138,7 +138,7 @@ where
next.exercise_slide_submission_id.to_string(),
next.id.to_string(),
next.user_id.to_string(),
next.created_at.to_string(),
next.created_at.to_rfc3339(),
next.course_instance_id
.map(|o| o.to_string())
.unwrap_or_else(|| "".to_string()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ where
while let Some(next) = stream.try_next().await? {
let csv_row = vec![
next.user_id.to_string(),
next.created_at.to_string(),
next.updated_at.to_string(),
next.created_at.to_rfc3339(),
next.updated_at.to_rfc3339(),
next.first_name.unwrap_or_default(),
next.last_name.unwrap_or_default(),
next.email.to_string(),
Expand Down
11 changes: 6 additions & 5 deletions services/main-frontend/src/components/PermissionPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { css } from "@emotion/css"
import { Check, Clear, Create, ExpandMore } from "@mui/icons-material"
import { ExpandMore } from "@mui/icons-material"
import { useQuery } from "@tanstack/react-query"
import { CheckCircle, Pencil, XmarkCircle } from "@vectopus/atlas-icons-react"
import { t as globalT, TFunction } from "i18next"
import { useRouter } from "next/router"
import React, { useState } from "react"
Expand Down Expand Up @@ -296,7 +297,7 @@ export const PermissionPage: React.FC<React.PropsWithChildren<Props>> = ({ domai
`}
onClick={() => setEditingRole({ userId: ur.id, newRole: ur.role })}
>
<Create />
<Pencil />
</button>
<button
aria-label={t("remove-role")}
Expand All @@ -308,7 +309,7 @@ export const PermissionPage: React.FC<React.PropsWithChildren<Props>> = ({ domai
`}
onClick={() => removeMutation.mutate({ email: ur.email, role: ur.role })}
>
<Clear />
<XmarkCircle />
</button>
</td>
</>
Expand Down Expand Up @@ -344,7 +345,7 @@ export const PermissionPage: React.FC<React.PropsWithChildren<Props>> = ({ domai
setEditingRole(null)
}}
>
<Check />
<CheckCircle />
</button>{" "}
<button
aria-label={t("cancel-editing-role")}
Expand All @@ -356,7 +357,7 @@ export const PermissionPage: React.FC<React.PropsWithChildren<Props>> = ({ domai
`}
onClick={() => setEditingRole(null)}
>
<Clear />
<XmarkCircle />
</button>
</td>
</>
Expand Down
Loading

0 comments on commit 057e1b4

Please sign in to comment.