-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removed draft-js * User segment WIP * WIP: Populating filters from query param * Almost final designs for Segments and Filters * New component: Filter container * Finished filter and segments basic implementation * Added docs * Removed console.log * Fixed CodeQL warnings * Removing CodeQL issues * Removed unused import --------- Co-authored-by: Rajat Saxena <[email protected]>
- Loading branch information
1 parent
9d05dd2
commit 45d040a
Showing
98 changed files
with
2,508 additions
and
557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ coverage | |
|
||
# Text editors configurations | ||
.vscode | ||
.rgignore | ||
|
||
# Env file | ||
.env*.local | ||
|
Binary file not shown.
Binary file added
BIN
+21.1 KB
.yarn/cache/@msgpackr-extract-msgpackr-extract-linux-x64-npm-3.0.2-262fca760d-8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+25.9 KB
.yarn/cache/@radix-ui-react-dismissable-layer-npm-1.0.5-fbc4b71169-e73cf4bd37.zip
Binary file not shown.
Binary file added
BIN
+28.2 KB
.yarn/cache/@radix-ui-react-focus-scope-npm-1.0.4-7b881d2f7e-3481db1a64.zip
Binary file not shown.
Binary file added
BIN
+28.6 KB
.yarn/cache/@radix-ui-react-popover-npm-1.0.7-349a58fc19-3ec15c0923.zip
Binary file not shown.
Binary file added
BIN
+30.7 KB
.yarn/cache/@radix-ui-react-popper-npm-1.1.3-d7804f4c70-b18a159586.zip
Binary file not shown.
Binary file added
BIN
+6.68 KB
.yarn/cache/@radix-ui-react-portal-npm-1.0.4-e4c93f6e90-c4cf35e2f2.zip
Binary file not shown.
Binary file added
BIN
+55.9 KB
.yarn/cache/@radix-ui-react-scroll-area-npm-1.0.5-05d3394998-1e0cf7af83.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
title: Filter users | ||
description: Filter users | ||
layout: ../../../layouts/MainLayout.astro | ||
--- | ||
|
||
As your school grows, your user base will also grow. Filters help you in sifting through your users to quickly find the users you are interested in. | ||
|
||
![Users filters](/assets/users/user-filtering.png) | ||
|
||
## Apply a filter | ||
|
||
To apply a filter: | ||
|
||
1. Click on the `Filters` button to reveal all the available filters. | ||
|
||
![Users filters in action](/assets/users/filter-click.gif) | ||
|
||
2. Select the filter you are interested in, to reveal its settings. | ||
3. Click `Apply` to apply the filter. The applied filter will be visible beneath the filters bar. | ||
|
||
![Users filters applied](/assets/users/apply-filter.gif) | ||
|
||
4. The users list will refresh automatically and the total number of users satisfying the selected filter will be visible on the right side of the filters bar. | ||
|
||
![Total users count after filter apply](/assets/users/total-users-count-after-filter.png) | ||
|
||
## Remove a filter | ||
|
||
To remove a filter, simply click on the `Cross` icon on the filter chip. | ||
|
||
![Remove filter](/assets/users/remove-filter.gif) | ||
|
||
## Work with multiple filters | ||
|
||
You can add as many filters as you would like. You can additionally choose how these filters fit together. | ||
|
||
CourseLit offers two ways to match filters. | ||
|
||
##### Match any filter | ||
|
||
Users matching any of the filters will show up in the results. This is the default. | ||
|
||
##### Match all filters | ||
|
||
Users matching all of the applied filters will show up in the results. | ||
|
||
To switch the matching filter, select the desired option from the dropdown on the left (right beneath the `Segments` button). | ||
|
||
![Match filters](/assets/users/matching-filters.gif) | ||
|
||
## Search by email | ||
|
||
CourseLit offers a quick way to search users via email addresses. If you know any part of the user's email, you can quickly search for it by typing in the search bar. | ||
|
||
![Search by email filter](/assets/users/search-by-email-filter.gif) | ||
|
||
This filter behaves just like any other filter. Multiple patterns can be searched by entering one pattern at a time. | ||
|
||
## Next step | ||
|
||
Learn how to [segment users](/en/users/segment). | ||
|
||
## Stuck somewhere? | ||
|
||
We are always here for you. Come chat with us in our <a href="https://discord.com/invite/GR4bQsN" target="_blank">Discord</a> channel or send a tweet at <a href="https://twitter.com/courselit" target="_blank">@CourseLit</a>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: Segment users | ||
description: Segment users | ||
layout: ../../../layouts/MainLayout.astro | ||
--- | ||
|
||
You can bucket users with common characteristics into distinct groups called `Segments`. User segmentation helps you in managing the users efficiently. | ||
|
||
CourseLit offers an easy way to create new user segments. By default, your account has only one segment called `Everyone` which includes all the users in your school. | ||
|
||
## Switching segments | ||
|
||
By default, the `Everyone` segment is selected. The segment includes all the users in your school. | ||
|
||
To switch to any other previously saved segment, click on the segment button i.e. the button with the `Everyone` label. | ||
|
||
![Segment selector](/assets/users/segment-selector.png) | ||
|
||
Let's see how to create a segment. | ||
|
||
## Create a segment | ||
|
||
To create a segment: | ||
|
||
1. Apply some filters to reveal the `Save new segment` button. | ||
|
||
![Add filters for segmentation](/assets/users/add-filters-for-segmentation.gif) | ||
|
||
2. Once you are satisfied with the applied filters, click on the `Save new segment` button to reveal a popup. | ||
|
||
3. Enter a name for this user segment and click `Save`. | ||
|
||
![Save segment](/assets/users/save-segment.gif) | ||
|
||
4. The saved segment can now be accessed from the `Segments` dropdown on the left (as shown above). | ||
|
||
## Delete a segment | ||
|
||
To delete a segment: | ||
|
||
1. Click on the `Segments` button to reveal the saved segments. | ||
|
||
![Open segment popover](/assets/users/open-segment-popup.gif) | ||
|
||
2. Click on the `Trash can` icon against the segment you want to delete. | ||
|
||
3. Click `Delete` to confirm the deletion of the segment. | ||
|
||
![Delete segment](/assets/users/delete-segment.gif) | ||
|
||
## Stuck somewhere? | ||
|
||
We are always here for you. Come chat with us in our <a href="https://discord.com/invite/GR4bQsN" target="_blank">Discord</a> channel or send a tweet at <a href="https://twitter.com/courselit" target="_blank">@CourseLit</a>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
JWT_SECRET=any_random_value | ||
DB_CONNECTION_STRING=mongodb_connection_string | ||
DB_CONNECTION_STRING=mongodb_connection_string |
49 changes: 49 additions & 0 deletions
49
apps/web/components/admin/users/filter-container/filter-chip.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { IconButton, Tooltip } from "@courselit/components-library"; | ||
import { Cross } from "@courselit/icons"; | ||
import { capitalize } from "@courselit/utils"; | ||
import { USER_FILTER_CHIP_TOOLTIP } from "@ui-config/strings"; | ||
import { useMemo } from "react"; | ||
import Filter from "@ui-models/filter"; | ||
import permissionToCaptionMap from "../permissions-to-caption-map"; | ||
|
||
interface FilterChipProps { | ||
filter: Filter; | ||
index: number; | ||
onRemove: (index: number) => void; | ||
} | ||
|
||
export default function FilterChip({ | ||
filter, | ||
index, | ||
onRemove, | ||
}: FilterChipProps) { | ||
const { name, condition, value, valueLabel } = filter; | ||
|
||
const displayedValue = useMemo(() => { | ||
let dispValue = valueLabel || value; | ||
if (name === "subscription") { | ||
dispValue = ""; | ||
} | ||
if (name === "permission") { | ||
dispValue = permissionToCaptionMap[value]; | ||
} | ||
return dispValue; | ||
}, [name, value, valueLabel]); | ||
|
||
return ( | ||
<div className="text-xs flex flex-wrap py-[2px] px-[4px] items-center rounded bg-slate-200"> | ||
<div> | ||
<span className="font-medium">{capitalize(name)}</span>:{" "} | ||
<span className="italic">{condition}</span>{" "} | ||
{displayedValue && ( | ||
<span className="font-medium"> {displayedValue}</span> | ||
)} | ||
</div> | ||
<IconButton variant="transparent" onClick={() => onRemove(index)}> | ||
<Tooltip title={USER_FILTER_CHIP_TOOLTIP}> | ||
<Cross /> | ||
</Tooltip> | ||
</IconButton> | ||
</div> | ||
); | ||
} |
20 changes: 20 additions & 0 deletions
20
apps/web/components/admin/users/filter-container/filter-editor/categories-map.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
USER_FILTER_CATEGORY_EMAIL, | ||
USER_FILTER_CATEGORY_LAST_ACTIVE, | ||
USER_FILTER_CATEGORY_PERMISSION, | ||
USER_FILTER_CATEGORY_PRODUCT, | ||
USER_FILTER_CATEGORY_SIGNED_UP, | ||
USER_FILTER_CATEGORY_SUBSCRIPTION, | ||
} from "@ui-config/strings"; | ||
import Filter from "@ui-models/filter"; | ||
|
||
const categoriesMap: Record<Filter["name"], string> = { | ||
email: USER_FILTER_CATEGORY_EMAIL, | ||
product: USER_FILTER_CATEGORY_PRODUCT, | ||
lastActive: USER_FILTER_CATEGORY_LAST_ACTIVE, | ||
signedUp: USER_FILTER_CATEGORY_SIGNED_UP, | ||
subscription: USER_FILTER_CATEGORY_SUBSCRIPTION, | ||
permission: USER_FILTER_CATEGORY_PERMISSION, | ||
}; | ||
|
||
export default categoriesMap; |
Oops, something went wrong.
45d040a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
courselit – ./
courselit-git-main-codelit.vercel.app
courselit-codelit.vercel.app
*.clqa.xyz