Skip to content

Commit

Permalink
fix: changes suggested by Majk
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebubeker committed Oct 30, 2023
1 parent 4a99f49 commit da439df
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions apps/web/app/[lng]/map/[projectId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export default function MapPage({ params: { projectId } }) {
(state: IStore) => state.mapFilters,
);

const { getFilterQueryExpressions } = useFilterExpressions(projectId);
const { getFilterQueries } = useFilterExpressions(projectId);

const { data: filters } = getFilterQueryExpressions(layerToBeFiltered);
const { data: filters } = getFilterQueries(layerToBeFiltered);

const [layers, setLayers] = useState<XYZ_Layer[] | []>([
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import type { ResponseResult } from "@/types/common";
import { useTranslation } from "@/i18n/client";
import { LoadingButton } from "@mui/lab";

export default function OrganizationInviteJoin({ params: { lng, inviteId } }) {
export default function OrganizationInviteJoin({ params: { inviteId } }) {
const theme = useTheme();
const [queryParams, _setQueryParams] = useState<GetInvitationsQueryParams>({
type: "organization",
Expand All @@ -37,7 +37,7 @@ export default function OrganizationInviteJoin({ params: { lng, inviteId } }) {
const { status, data: session, update } = useSession();
const router = useRouter();
const [isBusy, setIsBusy] = useState(false);
const { t } = useTranslation(lng, ["onboarding", "common"]);
const { t } = useTranslation(["onboarding", "common"]);
const [responseResult, setResponseResult] = useState<ResponseResult>({
message: "",
status: undefined,
Expand Down
6 changes: 3 additions & 3 deletions apps/web/components/map/MapboxOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ export function groupBySource(
layers: (SourceProps & ZodLayer)[]
): GroupedLayer[] {
const groupedLayers = layers.reduce((acc, layer) => {
const { url, data_type, data_source_name, data_reference_year, ...rest } =
const { url, data_type, data_source_name, data_reference_year, layers } =
layer;
const existingGroup = acc.find(
(group) => group.url === url && group.data_type === data_type
);
if (existingGroup) {
existingGroup.layers.push(rest);
existingGroup.layers.push(layers);
} else {
acc.push({
url,
data_type,
data_source_name,
data_reference_year,
layers: [rest],
layers: [layers],
});
}
return acc;
Expand Down
5 changes: 3 additions & 2 deletions apps/web/hooks/map/FilteringHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useFilterQueryExpressions } from "@/lib/api/filter";
import { useDispatch } from "react-redux";
import { setMapLoading } from "../../lib/store/map/slice";

export const useFilterExpressions = (projectId: string) => {
export const useFilterExpressions = (projectId?: string) => {
const PROJECTS_API_BASE_URL = new URL(
"api/v2/project",
process.env.NEXT_PUBLIC_API_URL,
Expand All @@ -16,7 +16,7 @@ export const useFilterExpressions = (projectId: string) => {
mutate,
isLoading,
error,
} = useFilterQueryExpressions(projectId);
} = useFilterQueryExpressions(projectId ? projectId : "");

const getLayerFilterParsedExpressions = (queries) => {
const expressions = Object.keys(queries).map((query) =>
Expand Down Expand Up @@ -63,6 +63,7 @@ export const useFilterExpressions = (projectId: string) => {
};
}
}
return {data: [], mutate}
};

const getFilterQueryExpressions = (layerId: string) => {
Expand Down
1 change: 1 addition & 0 deletions apps/web/lib/validations/layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const layerMetadataSchema = contentMetadataSchema.extend({
});

export const layerSchema = layerMetadataSchema.extend({
active: z.boolean().optional(),
updated_at: z.string(),
created_at: z.string(),
extent: z.string(),
Expand Down

0 comments on commit da439df

Please sign in to comment.