Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
de6b3bb
fix: layout and font size
zant Nov 5, 2024
2f38bb8
Merge pull request #58 from socialappslab/fix/no-ticket/layout-font-size
zant Nov 5, 2024
c5b37a8
fix: label
zant Nov 5, 2024
15a5741
Merge pull request #59 from socialappslab/fix/no-ticket/layout-font-size
zant Nov 5, 2024
a353800
fix: render dates
zant Nov 5, 2024
f5863f3
Merge pull request #60 from socialappslab/fix/424/date-not-showing
zant Nov 5, 2024
f024388
fix: i18n feed
zant Nov 5, 2024
23b3fa1
feat: add city to create brigade form
zant Nov 5, 2024
f115851
Merge pull request #61 from socialappslab/fix/423/city-create-brigade
zant Nov 5, 2024
c525415
feat: setup rollbar
zant Nov 6, 2024
a59d125
Merge pull request #62 from socialappslab/feat/354/rollbar-setup
zant Nov 6, 2024
e65709d
feat: update layout
zant Nov 6, 2024
a502e76
chore: remove unused
zant Nov 6, 2024
1b803a8
Merge pull request #63 from socialappslab/fix/no-ticket/layout-buttons
zant Nov 6, 2024
1865ddf
fix: unused
zant Nov 6, 2024
9a544b4
feat: add isologo to ranking
zant Nov 6, 2024
c07d52c
Merge pull request #64 from socialappslab/feat/no-ticket/isologo-ranking
zant Nov 6, 2024
38b4f88
fix: remove unused
zant Nov 6, 2024
343ad5e
fix: uppercase titles
zant Nov 12, 2024
b007eaa
Merge pull request #65 from socialappslab/fix/445/uppercase-brigade
zant Nov 12, 2024
03c6afa
feat: add tooltip to progress bar
zant Nov 12, 2024
b16bf57
Merge pull request #66 from socialappslab/feat/372/tooltips
zant Nov 12, 2024
f4e6002
fix: remove team leader
zant Nov 12, 2024
2e4c794
Merge pull request #67 from socialappslab/fix/427/remove-team-lider
zant Nov 12, 2024
d2436bd
fix: fix sorting and layout
zant Nov 14, 2024
cbb2051
Merge pull request #68 from socialappslab/fix/447/filters-not-working
zant Nov 14, 2024
69f3225
feat: add a new menu for Reports along with its submenus
fego-dev Nov 19, 2024
dbc4b87
feat: add new routes for reports
fego-dev Nov 19, 2024
53208f4
feat: add some translations
fego-dev Nov 19, 2024
5e89a05
feat: add the reports itself
fego-dev Nov 19, 2024
0c0d45b
feat: add a new icon for reports menu
fego-dev Nov 19, 2024
df20197
Merge pull request #69 from socialappslab/feat/465/reports
zant Nov 19, 2024
6c2469c
fix: fix translations
fego-dev Nov 19, 2024
c121cc8
Merge pull request #70 from socialappslab/feat/465/reports
fego-dev Nov 19, 2024
559137b
fix: fix labels and the team form(fields orders)
fego-dev Nov 20, 2024
15595df
Merge pull request #71 from socialappslab/fix/457/Change-text-for-Bri…
fego-dev Nov 20, 2024
4593b00
fix: change all labels and text from denguechat+ to DengueChatPlus
fego-dev Nov 20, 2024
9fa2a88
Merge pull request #72 from socialappslab/fix/440/Change-denguechat+-…
fego-dev Nov 20, 2024
61b1af6
feat: add visits list
zant Nov 26, 2024
e81a50c
Merge pull request #73 from socialappslab/feat/469/list-visits
zant Nov 26, 2024
31120d4
fix: typing
zant Nov 29, 2024
09aaa5b
Merge pull request #74 from socialappslab/feat/469/list-visits
zant Nov 29, 2024
81f515b
feat: change sidebar community
zant Nov 29, 2024
d60cc9e
Merge pull request #75 from socialappslab/feat/439/web-sidebar
zant Nov 29, 2024
5f8f3d3
fix: adjust styles
zant Nov 29, 2024
2d97e5f
Merge pull request #76 from socialappslab/fix/449/adjust-styles
zant Nov 29, 2024
b513d0b
feat: update my community page
zant Nov 29, 2024
225a01a
Merge pull request #77 from socialappslab/fix/456/my-community-updates
zant Nov 29, 2024
d7cecbf
feat: add margin
zant Nov 29, 2024
5a82f91
Merge pull request #78 from socialappslab/fix/456/my-community-updates
zant Nov 29, 2024
ffe14d4
fix: change date format on tables
fego-dev Dec 5, 2024
7735f35
Merge pull request #79 from socialappslab/fix/489/WEB-Unify-date-form…
fego-dev Dec 5, 2024
932da84
fix: use the real input name instead only "name" in all filters
fego-dev Dec 5, 2024
8f26095
fix: i change name to city name
fego-dev Dec 5, 2024
862d456
Merge pull request #80 from socialappslab/fix/490/Change-text-Brigadi…
fego-dev Dec 5, 2024
1a7bc6c
fix: progress bar issue
fego-dev Dec 5, 2024
c4ee58a
fix: progress bar issue
fego-dev Dec 5, 2024
5f84128
Merge pull request #81 from socialappslab/fix/no-ticket/progress-bar-…
fego-dev Dec 5, 2024
e82593a
fix: update the risk chart url in my community page
fego-dev Dec 6, 2024
d1b4645
Merge pull request #82 from socialappslab/fix/no-ticket/update-the-ri…
fego-dev Dec 6, 2024
be013ad
fix: add headers source to risk chart
fego-dev Dec 6, 2024
f60e3bd
Merge pull request #83 from socialappslab/fix/no-ticket/add-headers-t…
fego-dev Dec 6, 2024
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
1 change: 1 addition & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ VITE_API_URL="https://apisandbox.denguechatplus.org"
VITE_HOST="develop.denguechatplus.org"
VITE_DEFAULT_LANG="es"
VITE_LOCALE="es-ES"
ROLLBAR_ACCESS_TOKEN=
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DengueChat+
# DengueChatPlus

Web project for DengueChat

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/>
<link rel="icon" type="image/svg+xml" href="/src/assets/images/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DengueChat+</title>
<title>DengueChatPlus</title>
</head>
<body>
<div id="root-app"></div>
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@mui/icons-material": "^5.16.1",
"@mui/material": "^5.15.20",
"@mui/x-date-pickers": "^7.7.1",
"@rollbar/react": "^0.12.0-beta",
"@tanstack/react-query": "^5.59.16",
"axios": "^1.7.2",
"axios-auth-refresh": "^3.3.6",
Expand All @@ -44,6 +45,7 @@
"react-infinite-scroll-component": "^6.1.0",
"react-number-format": "^5.4.0",
"react-router-dom": "^6.24.0",
"rollbar": "^2.26.4",
"tailwind-merge": "^2.3.0",
"vite-plugin-svgr": "^4.2.0",
"zod": "^3.23.8"
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const App: React.FC = () => (
<>
<div className="text-center selection:bg-green-900 bg-[#282c34] text-white min-h-screen pt-32" />
<div>DengueChat+</div>
<div>DengueChatPlus</div>
</>
);

Expand Down
3 changes: 3 additions & 0 deletions src/assets/icons/fact-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/help.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/icons/reports.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/CommentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const CommentBox = ({ postId }: CommentBoxProps) => {

return (
<Box>
<Box className="flex items-center gap-4 mt-6">
<Box className="flex grid gap-2 mt-6">
<Box className="min-w-20 min-h-20 -tracking-4 bg-green-100 rounded-full flex items-center justify-center">
<Text className="mb-0 text-green-800 font-bold -tracking-4 uppercase">{acronym}</Text>
</Box>
Expand Down
11 changes: 7 additions & 4 deletions src/components/PostBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import ThumbsUp from '@/assets/icons/thumbs-up.svg';
import Trash from '@/assets/icons/trash.svg';
import Text from '@/themed/text/Text';
import CommentBox from './CommentBox';
import { formatDateFromString } from '@/util';
import useLangContext from '@/hooks/useLangContext';

interface PostProps {
id: number;
author: string;
date: number;
date: string;
location: string;
text: string;
image?: { photo_url: string };
Expand All @@ -20,20 +22,21 @@ interface PostProps {
}

const PostBox = ({ author, date, location, text, likes, image, id, comments, acronym }: PostProps) => {
const langContext = useLangContext();
const { t } = useTranslation('feed');
const [imageLoaded, setImageLoaded] = useState(false);
const [openComments, setOpenComments] = useState(false);

return (
<Box key={id} className="flex-col border-solid border-neutral-100 rounded-md p-8 flex justify-between mb-4">
<Box key={id} className="flex-col border-solid border-neutral-100 rounded-md p-6 flex justify-between mb-4">
<Box className="flex items-center gap-4 mb-6">
<Box className="w-20 h-20 -tracking-4 bg-green-100 rounded-full flex items-center justify-center">
<Box className="w-10 h-10 -tracking-4 bg-green-100 rounded-full flex items-center justify-center">
<Text className="mb-0 text-green-800 font-bold -tracking-4 uppercase">{acronym}</Text>
</Box>
<Box>
<Text className="mb-0 font-semibold">{author}</Text>
<Text className="mb-0 opacity-60">
{date} • {location}
{formatDateFromString(langContext.state.selected, date)} • {location}
</Text>
</Box>
</Box>
Expand Down
22 changes: 18 additions & 4 deletions src/components/RiskChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,38 @@ const RiskChart = () => {

const [{ data, loading }] = useAxios<HouseReport, null, ErrorResponse>({
url: `reports/house_status`,
headers: {
source: 'visits',
},
});

const label = `${(user?.team as BaseObject)?.name}: ${t('riskChart.title')}`;

const totalQuantity = (data?.redQuantity || 0) + (data?.orangeQuantity || 0) + (data?.greenQuantity || 0);
return (
<Box className="border-solid border-neutral-100 rounded-md p-6 mb-4">
<Title label={label} type="subsection" className="mb-0" />
<Box className="flex flex-col mt-6">
{loading && <Loader />}
{!loading && (
<>
<ProgressBar label={t('riskChart.greenSites')} progress={data?.greenQuantity || 0} color="bg-green-600" />
<ProgressBar
label={t('riskChart.greenSites')}
value={data?.greenQuantity || 0}
progress={totalQuantity > 0 ? Math.round(((data?.greenQuantity || 0) / totalQuantity) * 100) : 0}
color="bg-green-600"
/>
<ProgressBar
label={t('riskChart.yellowSites')}
progress={data?.orangeQuantity || 0}
value={data?.orangeQuantity || 0}
progress={totalQuantity > 0 ? Math.round(((data?.orangeQuantity || 0) / totalQuantity) * 100) : 0}
color="bg-yellow-600"
/>
<ProgressBar label={t('riskChart.redSites')} progress={data?.redQuantity || 0} color="bg-red-600" />
<ProgressBar
label={t('riskChart.redSites')}
value={data?.redQuantity || 0}
progress={totalQuantity > 0 ? Math.round(((data?.redQuantity || 0) / totalQuantity) * 100) : 0}
color="bg-red-600"
/>
</>
)}
</Box>
Expand Down
3 changes: 2 additions & 1 deletion src/components/SelectLanguageComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const getLocaleDisplayName = (locale: string, displayLocale?: string) => {
return displayName.charAt(0).toLocaleUpperCase() + displayName.slice(1);
};

function SelectLanguageComponent() {
function SelectLanguageComponent({ className }: { className?: string }) {
const { i18n } = useTranslation();
const { resolvedLanguage: currentLanguage } = i18n;

Expand Down Expand Up @@ -70,6 +70,7 @@ function SelectLanguageComponent() {
onChange(e.target.value);
}
}}
className={className}
>
{options.map((option) => (
<MenuItem key={`key-${option.value}`} value={option.value}>
Expand Down
18 changes: 15 additions & 3 deletions src/components/SitesReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,24 @@ const SitesReport = () => {
const { t } = useTranslation('feed');

return (
<Box className="border-solid border-neutral-100 rounded-md p-6 mb-4">
<Box className="border-solid border-neutral-100 rounded-md p-6 mb-10">
<Title label={t('sitesReport.title')} type="subsection" className="mb-0" />
<Box className="flex flex-col mt-6">
<>
<ProgressBar label={t('sitesReport.title')} progress={60} color="bg-green-600" />
<ProgressBar label={t('sitesReport.quantity')} progress={80} color="bg-green-800" />
<ProgressBar
label={t('sitesReport.title')}
value={60}
progress={60}
color="bg-green-600"
tooltip={t('sitesReport.tarikiSiteInfo')}
/>
<ProgressBar
label={t('sitesReport.quantity')}
value={80}
progress={80}
color="bg-green-800"
tooltip={t('sitesReport.greenContainersInfo')}
/>
</>
</Box>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/components/dialog/CreateCityDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export function CreateCityDialog({ handleClose, updateTable }: CreateCityDialogP
<FormInput
className="mt-2"
name="name"
label={t('admin:cities.form.name')}
label={t('admin:cities.form.name_placeholder')}
type="text"
placeholder={t('admin:cities.form.name_placeholder')}
/>
Expand Down
54 changes: 35 additions & 19 deletions src/components/dialog/CreateTeamDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ErrorResponse } from 'react-router-dom';
import useAxios from 'axios-hooks';
import { zodResolver } from '@hookform/resolvers/zod';
import useCreateMutation from '@/hooks/useCreateMutation';
import { FormSelectOption } from '@/schemas';
import { BaseObject, FormSelectOption } from '@/schemas';
import { CreateTeam, CreateTeamInputType, createTeamSchema } from '@/schemas/create';
import { Team } from '@/schemas/entities';
import FormMultipleSelect from '@/themed/form-multiple-select/FormMultipleSelect';
Expand All @@ -21,6 +21,7 @@ import { Button } from '../../themed/button/Button';
import { FormInput } from '../../themed/form-input/FormInput';
import { Title } from '../../themed/title/Title';
import { convertToFormSelectOptions, extractAxiosErrorData } from '../../util';
import useStateContext from '@/hooks/useStateContext';

export interface EditUserProps {
user: IUser;
Expand All @@ -32,8 +33,8 @@ interface CreateTeamDialogProps {
}

export function CreateTeamDialog({ handleClose, updateTable }: CreateTeamDialogProps) {
// const { state } = useStateContext();
// const user = state.user as IUser;
const { state } = useStateContext();
const user = state.user as IUser;
const { t } = useTranslation(['register', 'errorCodes', 'admin', 'translation']);
const { createMutation: createTeamMutation, loading: mutationLoading } = useCreateMutation<CreateTeam, Team>(
`/teams`,
Expand Down Expand Up @@ -103,6 +104,21 @@ export function CreateTeamDialog({ handleClose, updateTable }: CreateTeamDialogP
}
}, [wedgesData]);

const [cityOptions, setCityOptions] = useState<FormSelectOption[]>([]);

const [{ data: cityData, loading: loadingCities }] = useAxios<ExistingDocumentObject, unknown, ErrorResponse>({
url: `countries/${(user.country as BaseObject).id}/states/${user.state.id}/cities`,
});

useEffect(() => {
if (!cityData) return;
const deserializedData = deserialize(cityData);
if (Array.isArray(deserializedData)) {
const cities = convertToFormSelectOptions(deserializedData);
setCityOptions(cities);
}
}, [cityData]);

const { enqueueSnackbar } = useSnackbar();

const methods = useForm<CreateTeamInputType>({
Expand Down Expand Up @@ -166,7 +182,7 @@ export function CreateTeamDialog({ handleClose, updateTable }: CreateTeamDialogP
autoComplete="off"
className="w-full p-8"
>
<Title type="section" className="self-center mb-8i w-full" label="Create team" />
<Title type="section" className="self-center mb-8i w-full" label={t('admin:teams.create_team')} />
<Grid container spacing={2}>
<Grid item xs={12} sm={12}>
<FormInput
Expand All @@ -188,22 +204,12 @@ export function CreateTeamDialog({ handleClose, updateTable }: CreateTeamDialogP
</Grid>
<Grid item xs={12} sm={12}>
<FormSelect
name="leaderId"
name="cityId"
className="mt-2"
label={t('admin:teams.form.team_leader')}
loading={loadingUsers}
options={userOptions}
placeholder={t('admin:teams.form.team_leader_placeholder')}
/>
</Grid>
<Grid item xs={12} sm={12}>
<FormSelect
name="organizationId"
className="mt-2"
label={t('admin:teams.form.organization')}
loading={loadingOrganizations}
options={organizationOptions}
placeholder={t('admin:teams.form.organization_placeholder')}
label={t('admin:teams.form.city')}
loading={loadingCities}
options={cityOptions}
placeholder={t('admin:teams.form.city_placeholder')}
/>
</Grid>
<Grid item xs={12} sm={12}>
Expand All @@ -226,6 +232,16 @@ export function CreateTeamDialog({ handleClose, updateTable }: CreateTeamDialogP
placeholder={t('admin:teams.form.wedge_placeholder')}
/>
</Grid>
<Grid item xs={12} sm={12}>
<FormSelect
name="organizationId"
className="mt-2"
label={t('admin:teams.form.organization')}
loading={loadingOrganizations}
options={organizationOptions}
placeholder={t('admin:teams.form.organization_placeholder')}
/>
</Grid>
</Grid>

<div className="mt-8 grid grid-cols-1 gap-4 md:flex md:justify-end md:gap-0">
Expand Down
2 changes: 2 additions & 0 deletions src/components/icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Community from '@/assets/icons/community.svg?react';
import Data from '@/assets/icons/data.svg?react';
import Register from '@/assets/icons/register.svg?react';
import Export from '@/assets/icons/export.svg?react';
import FactCheck from '@/assets/icons/fact-check.svg?react';
import { COLORS } from '@/constants';

const IconMap = {
Expand All @@ -29,6 +30,7 @@ const IconMap = {
Comment,
Trash,
ThumbsUp,
FactCheck,
};

const Icon = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/list/CityList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const headCells: HeadCell<City>[] = [
},
{
id: 'name',
label: 'name',
label: 'city',
filterable: true,
sortable: true,
},
Expand Down
14 changes: 9 additions & 5 deletions src/components/list/FilteredDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { deserialize } from 'jsonapi-fractal';
import { useSnackbar } from 'notistack';
import { useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { PAGE_SIZES } from '../../constants';
import { PAGE_SIZES, PageSizes } from '../../constants';
import { PaginationInput } from '../../schemas/entities';
import Button from '../../themed/button/Button';
import DataTable, { DataTableProps, Order } from '../../themed/table/DataTable';
Expand All @@ -32,6 +32,7 @@ interface FilteredDataTableProps<T> extends Omit<DataTableProps<T>, 'rows'> {
updateControl?: number;
actions?: (row: T, loading?: boolean) => JSX.Element;
create?: () => JSX.Element;
pageSize?: PageSizes;
}

interface FilterOptionsObject {
Expand All @@ -49,6 +50,7 @@ export default function FilteredDataTable<T>({
updateControl,
actions,
create,
pageSize = PAGE_SIZES[0],
...otherDataTableProps
}: FilteredDataTableProps<T>) {
const { t } = useTranslation('translation');
Expand All @@ -59,7 +61,7 @@ export default function FilteredDataTable<T>({
const [searchText, setSearchText] = useState('');
const [searchSelect, setSearchSelect] = useState('');
const [selectedOption, setSelectedOption] = useState(defaultFilter || '');
const options = headCells.filter((cell) => cell.filterable).map((cell) => cell.id);
const options = headCells.filter((cell) => cell.filterable).map((cell) => ({ value: cell.id, label: cell.label }));
const filterOptions = useMemo(() => {
const filterOptionsObject: FilterOptionsObject = {};

Expand All @@ -74,7 +76,7 @@ export default function FilteredDataTable<T>({

const [payload, setPayload] = useState<PaginationInput>({
'page[number]': 1,
'page[size]': PAGE_SIZES[0],
'page[size]': pageSize,
sort: defaultSort,
order: defaultSort ? defaultOrder : undefined,
});
Expand Down Expand Up @@ -225,11 +227,12 @@ export default function FilteredDataTable<T>({
<MenuItem disabled value="">
{t(`table.selectAttribute`)}
</MenuItem>

{options.map((option, index) => (
<MenuItem key={`${option}-${index}`} value={option}>
<MenuItem key={`${option.value}-${index}`} value={option.value}>
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */}
{/* @ts-expect-error */}
{t(`columns.${option}`)}
{t(`columns.${option.label}`)}
</MenuItem>
))}
</Select>
Expand Down Expand Up @@ -257,6 +260,7 @@ export default function FilteredDataTable<T>({
}}
isLoading={loading}
actions={actions}
pageSize={pageSize}
/>
</>
);
Expand Down
Loading
Loading