Skip to content

Commit

Permalink
Documenation fix; Select component fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat Saxena committed Sep 26, 2023
1 parent dbef48c commit eaec6a9
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 34 deletions.
2 changes: 1 addition & 1 deletion apps/docs/src/pages/en/courses/add-content.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ CourseLit supports eight types of lessons, which are as follows.

7. Quiz

For quizzing your students. You can create graded and non-graded quizzes.
For quizzing your students. You can create graded and non-graded quizzes.

See the [guide to add a quiz](/en/lessons/add-quiz).

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/pages/en/self-hosting/self-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ We offer two ways to self-host CourseLit, which are as follows.

To quickly spin up an instance of CourseLit on Vercel, click the following button.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fcodelitdev%2Fcourselit&env=DB_CONNECTION_STRING,JWT_SECRET,SUPER_ADMIN_EMAIL,EMAIL_USER,EMAIL_PASS,EMAIL_HOST,EMAIL_FROM&envDescription=Configuration%20for%20your%20app&project-name=courselit&root-directory=apps%2Fweb&build-command=cd+..%2F+%26%26+git+checkout+workspace-based-resolution+%26%26+NODE_OPTIONS%3D--openssl-legacy-provider+yarn+build)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fcodelitdev%2Fcourselit&env=DB_CONNECTION_STRING,JWT_SECRET,SUPER_ADMIN_EMAIL,EMAIL_USER,EMAIL_PASS,EMAIL_HOST,EMAIL_FROM&envDescription=Configuration%20for%20your%20app&project-name=courselit&root-directory=apps%2Fweb&build-command=cd+..%2F+%26%26+NODE_OPTIONS%3D--openssl-legacy-provider+yarn+build)

> Note: File uploads will not work if you choose this method as this functionality is provided by our other product [MediaLit](https://github.com/codelitdev/medialit) which cannot be hosted on a serverless platforms like Vercel.
Expand Down
3 changes: 3 additions & 0 deletions apps/web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ yarn-error.log*

# typescript
*.tsbuildinfo

# analyze
/analyze
58 changes: 32 additions & 26 deletions apps/web/components/admin/users/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ThunkDispatch } from "redux-thunk";
import { AnyAction } from "redux";
import {
Tooltip,
Select as SingleSelect,
Select,
IconButton,
Table,
TableHead,
Expand All @@ -40,7 +40,7 @@ import {
} from "@courselit/components-library";
import { setAppMessage } from "@courselit/state-management/dist/action-creators";
//import { CSVLink } from "react-csv";
import { Cancel } from "@courselit/icons";
import { Cancel, Search } from "@courselit/icons";
import { useRouter } from "next/router";
import { UIConstants } from "@courselit/common-models";
import { Mail } from "@courselit/icons";
Expand Down Expand Up @@ -338,11 +338,17 @@ const UsersManager = ({
required
endIcon={
searchEmail ? (
<>
<span className="flex gap-2">
<IconButton
type="submit"
className="hidden"
></IconButton>
variant="soft"
onClick={(e) => {
e.preventDefault();
searchByEmail();
}}
>
<Search />
</IconButton>
<IconButton
aria-label="clear email search box"
variant="soft"
Expand All @@ -354,31 +360,31 @@ const UsersManager = ({
>
<Cancel />
</IconButton>
</>
</span>
) : null
}
/>
<SingleSelect
title={USER_FILTER_PERMISSION}
onChange={handleUserTypeChange}
value={type}
options={[
{ label: USER_TYPE_ALL, value: "" },
{
label: USER_TYPE_CUSOMER,
value: USER_TYPE_CUSOMER,
},
{
label: USER_TYPE_TEAM,
value: USER_TYPE_TEAM,
},
{
label: USER_TYPE_SUBSCRIBER,
value: USER_TYPE_SUBSCRIBER,
},
]}
/>
</Form>
<Select
title={USER_FILTER_PERMISSION}
onChange={handleUserTypeChange}
value={type}
options={[
{ label: USER_TYPE_ALL, value: "" },
{
label: USER_TYPE_CUSOMER,
value: USER_TYPE_CUSOMER,
},
{
label: USER_TYPE_TEAM,
value: USER_TYPE_TEAM,
},
{
label: USER_TYPE_SUBSCRIBER,
value: USER_TYPE_SUBSCRIBER,
},
]}
/>
{/*
<CSVLink
filename={"users-courselit.csv"}
Expand Down
1 change: 1 addition & 0 deletions packages/common-widgets/src/featured/admin-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export default function AdminWidget({
sublabel: capitalize(product.type),
}))}
onChange={addProduct}
defaultMessage={"Select a product"}
/>
<ul className="flex flex-col gap-4">
{products.map((product: string) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/components-library/src/form-field.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as React from "react";
import React from "react";
import {
Control,
CustomMatcher,
Expand Down Expand Up @@ -41,7 +41,7 @@ export interface FormFieldProps {
[key: string]: any;
name?: string;
className?: string;
endIcon?: string;
endIcon?: React.ReactNode;
}

export default function FormField({
Expand Down
12 changes: 8 additions & 4 deletions packages/components-library/src/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface SelectProps {
value: string | number;
title: string;
disabled?: boolean;
defaultMessage?: string;
}

export default function Select({
Expand All @@ -21,6 +22,7 @@ export default function Select({
value,
title,
disabled,
defaultMessage,
}: SelectProps) {
const id = `${title.split(" ").join().toLowerCase()}`;

Expand All @@ -38,10 +40,12 @@ export default function Select({
disabled={disabled}
className="border border-slate-300 hover:border-slate-400 py-1 px-2 rounded"
>
<option disabled selected value="">
{" "}
-- select an option --{" "}
</option>
{defaultMessage && (
<option disabled selected value="">
{" "}
{defaultMessage}{" "}
</option>
)}
{options.map((option: Option) => (
<option
value={option.value}
Expand Down

0 comments on commit eaec6a9

Please sign in to comment.