Skip to content

Commit

Permalink
chore: lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverqx committed Feb 22, 2024
1 parent 2113c32 commit d164321
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 45 deletions.
7 changes: 3 additions & 4 deletions packages/backend-lib/src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ function buildUserIdQueries({
if (cursor) {
if (direction === CursorDirectionEnum.Before) {
lastUserIdCondition = Prisma.sql`"userId" < ${cursor[CursorKey.UserIdKey]}`;

} else {
lastUserIdCondition = Prisma.sql`"userId" > ${cursor[CursorKey.UserIdKey]}`;
}
Expand Down Expand Up @@ -351,9 +350,9 @@ export async function deleteUsers({
const qb = new ClickHouseQueryBuilder();
const query = `
ALTER TABLE user_events_v2 DELETE WHERE workspace_id = ${qb.addQueryValue(
workspaceId,
"String",
)} AND user_id IN (${qb.addQueryValue(userIds, "Array(String)")});
workspaceId,
"String",
)} AND user_id IN (${qb.addQueryValue(userIds, "Array(String)")});
`;
await clickhouseClient().command({
query,
Expand Down
9 changes: 8 additions & 1 deletion packages/dashboard/src/components/usersFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,14 @@ export function UsersFilter({ workspaceId }: { workspaceId: string }) {
},
});
handler();
}, []);
}, [
apiBase,
getUserPropertiesRequest,
setGetUserPropertiesRequest,
setProperties,
setSegments,
workspaceId,
]);

return (
<Stack
Expand Down
72 changes: 34 additions & 38 deletions packages/dashboard/src/components/usersFilterSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Button from "@mui/material/Button";
import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import * as React from "react";

import { filterIds, FilterOptions, filterStore } from "../lib/filterStore";

enum Stage {
Expand All @@ -15,44 +16,40 @@ enum Stage {
function Options({
handleSelection,
filteredOptions,
isDisabled
isDisabled,
}: {
handleSelection: (selectedProperty: string | undefined) => void;
filteredOptions: [string, string][];
isDisabled: boolean
isDisabled: boolean;
}) {

return (
<>
{isDisabled
? (
<Stack minWidth="100%" justifyContent="center" alignItems="center">
<Typography
sx={{
opacity: "0.6"
}}
variant="caption"
paddingTop={"6px"}
component={"div"}
{isDisabled ? (
<Stack minWidth="100%" justifyContent="center" alignItems="center">
<Typography
sx={{
opacity: "0.6",
}}
variant="caption"
paddingTop="6px"
component="div"
>
Filtering by {filteredOptions[0] ? filteredOptions[0][1] : null}
</Typography>
</Stack>
) : (
<>
{filteredOptions.map((property) => (
<MenuItem
disabled={isDisabled}
key={property[0]}
onClick={() => handleSelection(property[0])}
>
Filtering by {filteredOptions[0] ? filteredOptions[0][1] : null}
</Typography>
</Stack>
)
: (
<>
{filteredOptions.map((property) => (
<MenuItem
disabled={isDisabled}
key={property[0]}
onClick={() => handleSelection(property[0])}
>
{property[1]}
</MenuItem>
))}
</>
)
}
{property[1]}
</MenuItem>
))}
</>
)}
</>
);
}
Expand All @@ -67,7 +64,6 @@ function IdAndValueSelector({
stage: Stage;
handleIdSelection: (selectedId: string | undefined) => void;
handleValueSelection: (propertyAssignmentId: string | undefined) => void;
workspaceId: string;
filter: string;
setFilter: (value: string) => void;
}) {
Expand Down Expand Up @@ -97,17 +93,17 @@ function IdAndValueSelector({
}

if (stage === Stage.SELECTING_VALUE) {
return [["", properties[selectedId]]] as [string, string][]
return [["", properties[selectedId]]] as [string, string][];
}

return [];
}, [stage, segments, properties]);
}, [stage, segments, properties, selectedFilter, selectedId]);

// Filter runs on filter and options change.
const filteredOptions = React.useMemo(() => {
if (Stage.SELECTING_VALUE) return options
if (stage === Stage.SELECTING_VALUE) return options;
return filterIds(options, filter);
}, [filter, options]);
}, [filter, options, stage]);

return (
<>
Expand Down Expand Up @@ -202,8 +198,8 @@ function SelectorFooter({
onClick={() => handlePrevious()}
/>
{selectedFilter === FilterOptions.USER_PROPERTY &&
stage === Stage.SELECTING_VALUE &&
filter !== "" ? (
stage === Stage.SELECTING_VALUE &&
filter !== "" ? (
<Typography
sx={{ fontSize: "10px", cursor: "pointer" }}
onClick={() => handleValueSelection(filter, true)}
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/components/usersTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export default function UsersTable({
segmentId
? ([...segmentFilterFromStore, ...segmentId] as string[])
: segmentFilterFromStore,
[segmentFilterFromStore],
[segmentFilterFromStore, segmentId],
);

const usersPage = useMemo(
Expand Down
2 changes: 1 addition & 1 deletion packages/dashboard/src/lib/filterStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function camelCaseToNormalText(camelCaseString: string) {
const words = camelCaseString.replace(/([a-z])([A-Z])/g, "$1 $2").split(" ");

// Capitalize each word
const capitalizedWords = words.map(function(word: string) {
const capitalizedWords = words.map((word: string) => {
return word.charAt(0).toUpperCase() + word.slice(1);
});

Expand Down

0 comments on commit d164321

Please sign in to comment.