Skip to content

Commit

Permalink
refactor imports and small changes after self review
Browse files Browse the repository at this point in the history
  • Loading branch information
Snorre98 committed Oct 31, 2024
1 parent 8d3b783 commit af5d05d
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 42 deletions.
2 changes: 1 addition & 1 deletion frontend/src/Components/Dropdown/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { Dropdown } from './Dropdown';
export type { DropdownProps } from './Dropdown';
export type { DropdownProps, DropdownOption } from './Dropdown';
4 changes: 2 additions & 2 deletions frontend/src/Components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { RecruitmentApplicantsStatus } from '../PagesAdmin/RecruitmentPositionOverviewPage/components/RecruitmentApplicantsStatus';
export { AccessDenied } from './AccessDenied';
export { AdminBox } from './AdminBox';
export { Alert } from './Alert';
Expand Down Expand Up @@ -63,6 +62,7 @@ export { SamfundetLogo } from './SamfundetLogo';
export { SamfundetLogoSpinner } from './SamfundetLogoSpinner';
export { useScrollToTop } from './ScrollToTop';
export { Select } from './Select';
export { SetInterviewManuallyModal } from './SetInterviewManually';
export { Skeleton } from './Skeleton';
export { SpinningBorder } from './SpinningBorder';
export { SplashHeaderBox } from './SplashHeaderBox';
Expand All @@ -89,7 +89,7 @@ export { Video } from './Video';

// Props
export type { CheckboxProps } from './Checkbox';
export type { DropdownProps } from './Dropdown';
export type { DropdownOption, DropdownProps } from './Dropdown';
export type { ImagePickerProps } from './ImagePicker/ImagePicker';
export type { InputFieldProps } from './InputField';
export type { InputFileProps } from './InputFile';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
gap: 1rem;
}

.sub_container {
margin-top: 1.5em;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useParams } from 'react-router-dom';
import { toast } from 'react-toastify';
import { Button, RecruitmentApplicantsStatus, Text } from '~/Components';
import { Button, Text } from '~/Components';
import {
getRecruitmentApplicationsForRecruitmentPosition,
getRecruitmentPosition,
Expand All @@ -17,7 +17,7 @@ import { ROUTES } from '~/routes';
import { dbT, lowerCapitalize } from '~/utils';
import { AdminPageLayout } from '../AdminPageLayout/AdminPageLayout';
import styles from './RecruitmentPositionOverviewPage.module.scss';
import { ProcessedApplicants } from './components';
import { ProcessedApplicants, RecruitmentApplicantsStatus } from './components';

// Define the possible states an application can be in within the recruitment process
// Applications flow through these states as they are processed by recruiters
Expand Down Expand Up @@ -204,27 +204,25 @@ export function RecruitmentPositionOverviewPage() {
}}
/>

<div className={styles.container}>
{applicationSections.map(({ type, title, helpText, emptyText }) => (
<div key={type} className={styles.sub_container}>
<Text size="l" as="strong" className={styles.subHeader}>
{t(title)} ({applications[type]?.length || 0})
{applicationSections.map(({ type, title, helpText, emptyText }) => (
<div key={type} className={styles.sub_container}>
<Text size="l" as="strong" className={styles.subHeader}>
{t(title)} ({applications[type]?.length || 0})
</Text>
{helpText && <Text className={styles.subText}>{t(helpText)}</Text>}
{applications[type]?.length > 0 ? (
<ProcessedApplicants
data={applications[type]}
type={type}
revertStateFunction={type !== 'withdrawn' ? updateApplicationState : undefined}
/>
) : (
<Text as="i" className={styles.subText}>
{t(emptyText)}
</Text>
{helpText && <Text className={styles.subText}>{t(helpText)}</Text>}
{applications[type]?.length > 0 ? (
<ProcessedApplicants
data={applications[type]}
type={type}
revertStateFunction={type !== 'withdrawn' ? updateApplicationState : undefined}
/>
) : (
<Text as="i" className={styles.subText}>
{t(emptyText)}
</Text>
)}
</div>
))}
</div>
)}
</div>
))}
</AdminPageLayout>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
justify-content: center;
}

.loadingApplState {
.loadingApplicationStatus {
display: block;
position: absolute;
width: 1rem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { Fragment } from 'react';
import { useTranslation } from 'react-i18next';
import { SamfundetLogoSpinner, TimeDisplay } from '~/Components';
import { CrudButtons } from '~/Components/CrudButtons/CrudButtons';
import { Dropdown, type DropdownOption } from '~/Components/Dropdown/Dropdown';
import { Table } from '~/Components/Table';
import { Text } from '~/Components/Text/Text';
import {
CrudButtons,
Dropdown,
type DropdownOption,
Link,
SamfundetLogoSpinner,
SetInterviewManuallyModal,
Table,
Text,
TimeDisplay,
} from '~/Components';
import type { RecruitmentApplicationDto, RecruitmentApplicationStateDto } from '~/dto';
import { useCustomNavigate } from '~/hooks';
import { KEY } from '~/i18n/constants';
import { reverse } from '~/named-urls';
import { ROUTES } from '~/routes';
import { Link } from '../../../../Components/Link';
import { SetInterviewManuallyModal } from '../../../../Components/SetInterviewManually';
import styles from './RecruitmentApplicantsStatus.module.scss';

type RecruitmentApplicantsStatusProps = {
Expand Down Expand Up @@ -166,7 +170,7 @@ export function RecruitmentApplicantsStatus({
style: applicationStatusStyle,
content: (
<Fragment>
{isUpdating && <SamfundetLogoSpinner className={styles.loadingApplState} />}
{isUpdating && <SamfundetLogoSpinner className={styles.loadingApplicationStatus} />}
<Dropdown
disabled={isUpdating}
value={application.recruiter_priority}
Expand All @@ -183,7 +187,7 @@ export function RecruitmentApplicantsStatus({
style: applicationStatusStyle,
content: (
<Fragment>
{isUpdating && <SamfundetLogoSpinner className={styles.loadingApplState} />}
{isUpdating && <SamfundetLogoSpinner className={styles.loadingApplicationStatus} />}
<Dropdown
disabled={isUpdating}
value={application.recruiter_status}
Expand Down

0 comments on commit af5d05d

Please sign in to comment.