Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
fa27318
feat(blog): Add blog listing and edit add form
crsstha Jan 7, 2026
aaec176
fixup! feat(blog): Add blog listing and edit add form
crsstha Jan 8, 2026
90ea349
feat(department): Add department list and edit add form
crsstha Jan 9, 2026
699f99a
feat(faq): Added Faq listig and edit add form
crsstha Jan 9, 2026
84421ef
feat(highlight): added highlight list and edit add form
crsstha Jan 12, 2026
a2d4645
feat(partner): Added partner listing and edit add form
crsstha Jan 13, 2026
2fafa3d
feat(news): Added news listing and edit add form
crsstha Jan 14, 2026
a5cae34
feat(procurement): Added procurement listing and edit add form
crsstha Jan 14, 2026
ca5ebda
feat(radio-program): Added radio program listing and edit add form
crsstha Jan 14, 2026
da1b2f9
fix(containers): added container wrapper
crsstha Jan 14, 2026
add9ae0
feat(vacancy): Added vacancy listing and edit add form
crsstha Jan 14, 2026
e030569
feat(project): Added project listing and edit add form
crsstha Jan 16, 2026
ab6cb17
feat(directive_and_user): Added directive listing and edit add form a…
crsstha Jan 19, 2026
e9a61af
feat(editor): added mdx-editor for rich text
crsstha Jan 20, 2026
15e9431
feat(dashboard): added simple dashboard
crsstha Jan 20, 2026
e017696
fix(clean-up): added alert and cleanup
crsstha Jan 22, 2026
826729f
feat(resources): Added resources listing and edit add form
crsstha Jan 22, 2026
5768906
fix(cleanup): use memo for rich text and setValue refactor
crsstha Jan 22, 2026
565017f
fixup! fix(cleanup): use memo for rich text and setValue refactor
crsstha Jan 22, 2026
be4fbdb
chore: update pnpm version and node version
AdityaKhatri Jan 27, 2026
c435ddb
feat(go-ui): update component with new version of go ui
crsstha Jan 29, 2026
a8cda2d
chore(pnpm): fix issue with pnpm lock
crsstha Jan 29, 2026
9d7d783
fix(clean-up): code clean up
crsstha Jan 30, 2026
4b47465
fixup! fix(clean-up): code clean up
crsstha Feb 2, 2026
c582006
fixup! fix(clean-up): code clean up
crsstha Feb 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20-bookworm AS dev
FROM node:22-bookworm AS dev

RUN apt-get update -y \
&& apt-get install -y --no-install-recommends \
Expand Down Expand Up @@ -51,4 +51,4 @@ COPY --from=nginx-build /code/build /code/build
# NOTE: Used by apply-config.sh
ENV APPLY_CONFIG__SOURCE_DIRECTORY=/code/build/
ENV APPLY_CONFIG__DESTINATION_DIRECTORY=/usr/share/nginx/html/
ENV APPLY_CONFIG__OVERWRITE_DESTINATION=true
ENV APPLY_CONFIG__OVERWRITE_DESTINATION=true
58 changes: 58 additions & 0 deletions app/components/EditDeleteActions/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { useCallback } from 'react';
import {
DeleteBinLineIcon,
EditTwoLineIcon,
} from '@ifrc-go/icons';
import {
Button,
ConfirmButton,
TableActions,
} from '@ifrc-go/ui';

import useRouting, { RoutesMap } from '#hooks/useRouting';

export interface EditDeleteActionsProps {
id: string ;
onDelete: (id: string) => void;
itemTitle: string;
to: keyof RoutesMap ;
}

function EditDeleteActions(props: EditDeleteActionsProps) {
const {
id,
onDelete,
itemTitle,
to,
} = props;

const navigate = useRouting();

const handleEditClick = useCallback(() => {
navigate(to, { id });
}, [navigate, to, id]);

return (
<TableActions>
<Button
name={undefined}
styleVariant="action"
colorVariant="secondary"
onClick={handleEditClick}
>
<EditTwoLineIcon />
</Button>
<ConfirmButton
name={id}
styleVariant="action"
colorVariant="secondary"
onConfirm={onDelete}
confirmMessage={`Are you sure you want to delete ${`"${itemTitle}"` || 'this item'}? This action cannot be undone.`}
>
<DeleteBinLineIcon />
</ConfirmButton>
</TableActions>
);
}

export default EditDeleteActions;
4 changes: 4 additions & 0 deletions app/components/EditDeleteActions/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.tableAction {
display: flex;
gap: var(--go-ui-spacing-md);
}
91 changes: 91 additions & 0 deletions app/components/FileUpload/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import {
Activity,
useCallback,
} from 'react';
import {
DeleteBinLineIcon,
UploadFillIcon,
} from '@ifrc-go/icons';
import {
IconButton,
InputError,
ListView,
RawFileInput,
SingleRawFileInputProps,
} from '@ifrc-go/ui';
import {
isDefined,
isNotDefined,
} from '@togglecorp/fujs';

interface Props<NAME> {
name: NAME;
label?: string;
value?: File;
accept?: string;
error?: string;
onChange: (value: File | undefined, name: NAME) => void;
}

function FileUpload<const NAME>(props: Props<NAME>) {
const {
value,
onChange,
name,
accept,
error,
label = 'Upload',
} = props;

const handleClearButtonClick = useCallback(() => {
onChange(undefined, name);
}, [onChange, name]);

const handleChange = useCallback<SingleRawFileInputProps<NAME>['onChange']>((file) => {
if (isNotDefined(file)) {
return;
}
onChange(file, name);
}, [onChange, name]);

return (
<>
<ListView withWrap spacing="sm" spacingOffset={-2}>
<RawFileInput
name={name}
onChange={handleChange}
accept={accept}
allowFullScreen
colorVariant="primary"
styleVariant="outline"
before={<UploadFillIcon />}
>
{label}
</RawFileInput>
<p>
{value?.name ? (
value.name
) : 'No document selected'}
</p>
<Activity mode={isDefined(value) ? 'visible' : 'hidden'}>
<IconButton
name={undefined}
onClick={handleClearButtonClick}
title="Clear"
ariaLabel="clear"
spacing="none"
>
<DeleteBinLineIcon />
</IconButton>
</Activity>
</ListView>
<Activity mode={error ? 'visible' : 'hidden'}>
<InputError>
{error}
</InputError>
</Activity>
</>
);
}

export default FileUpload;
115 changes: 115 additions & 0 deletions app/components/MarkdownEditor/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
import '@mdxeditor/editor/style.css';

import {
Activity,
memo,
useEffect,
useMemo,
useRef,
} from 'react';
import {
InputError,
ListView,
} from '@ifrc-go/ui';
import {
BlockTypeSelect,
BoldItalicUnderlineToggles,
CreateLink,
headingsPlugin,
imagePlugin,
InsertImage,
linkDialogPlugin,
linkPlugin,
listsPlugin,
ListsToggle,
markdownShortcutPlugin,
MDXEditor,
MDXEditorMethods,
quotePlugin,
thematicBreakPlugin,
toolbarPlugin,
UndoRedo,
} from '@mdxeditor/editor';

import useDebounce from '#hooks/useDebounce';

import styles from './styles.module.css';

interface Props{
value?: string;
onChange: (
value: string | undefined,
) => void;
error?: string;
placeholder?:string
}

function ToolbarContents() {
return (
<>
<UndoRedo />
<BoldItalicUnderlineToggles />
<BlockTypeSelect />
<ListsToggle />
<CreateLink />
<InsertImage />
</>
);
}

function MarkdownEditor(props: Props) {
const {
value = '',
onChange,
placeholder = 'Start writing here...',
error,
} = props;

const ref = useRef<MDXEditorMethods>(null);
const prevValueRef = useRef(value);

const debouncedSearch = useDebounce(onChange, 300);

useEffect(() => {
if (ref.current && !prevValueRef.current) {
ref.current.setMarkdown(value);
prevValueRef.current = value;
}
}, [value]);

const plugins = useMemo(() => [
headingsPlugin(),
listsPlugin({ enableOrdered: true, enableUnordered: true }),
imagePlugin(),
linkPlugin(),
linkDialogPlugin(),
quotePlugin(),
thematicBreakPlugin(),
markdownShortcutPlugin(),
toolbarPlugin({
toolbarClassName: 'my-classname',
toolbarContents: ToolbarContents,
}),
], []);

return (
<ListView layout="block" withCenteredContents withBackground>
<div className={styles.editor}>
<MDXEditor
markdown={value}
ref={ref}
onChange={debouncedSearch}
placeholder={placeholder}
plugins={plugins}
/>
</div>
<Activity mode={error ? 'visible' : 'hidden'}>
<InputError>
{error}
</InputError>
</Activity>
</ListView>
);
}

export default memo(MarkdownEditor);
37 changes: 37 additions & 0 deletions app/components/MarkdownEditor/styles.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.editor {
z-index: 0;
width: 100%;
min-height: var(--go-ui-width-min-modal);

>* {
flex: 1;
}
}

.editor p,
h1,
h2,
h3,
h4,
h5,
h6 {
margin: var(--go-ui-spacing-md) 0;
}

.editor ul,
.editor ol {
padding-left: var(--go-ui-spacing-xl);
}

.editor li {
margin: 4px 0;
}

.editor a {
text-decoration: underline;
color: var(--go-ui-color-dark-blue-20);

&:hover {
color: var(--go-ui-color-dark-blue-30);
}
}
Loading