Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xola-ui-kit",
"version": "1.4.1",
"name": "@xola/ui-kit",
"version": "1.4.2",
"description": "Xola UI Kit",
"main": "lib/index.js",
"license": "MIT",
Expand Down
39 changes: 38 additions & 1 deletion src/components/ScheduleEditor/ScheduleEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ const ScheduleEditor = ({ value = {}, errors = {}, price = 0, isNew = true, onCh
onChange({ ...updatedSchedule, summary: getScheduleSummary(updatedSchedule) });
};

const handleAllowedPrivaciesChange = (privacy) => {
let updatedPrivacies = [...schedule.allowedPrivacies];
if (updatedPrivacies.includes(privacy)) {
updatedPrivacies = updatedPrivacies.filter((p) => p !== privacy);
} else {
updatedPrivacies.push(privacy);
}
handleChange(updatedPrivacies, "allowedPrivacies");
};

return (
<div>
<ScheduleEditorRow label="Name" htmlFor="scheduleName">
Expand All @@ -41,10 +51,37 @@ const ScheduleEditor = ({ value = {}, errors = {}, price = 0, isNew = true, onCh
type="name"
name="scheduleName"
id="scheduleName"
placeholder="sm"
placeholder="Daily"
/>
</ScheduleEditorRow>
<ScheduleEditorRow
label="Allowed Privacies"
htmlFor="allowedPrivacies"
error={errors && errors.allowedPrivacies}
>
<div>
<CustomInput
inline
type="checkbox"
name="allowedPrivacies"
id="privacy-public"
label="Public"
value="public"
checked={schedule.allowedPrivacies.includes("public")}
onChange={(e) => handleAllowedPrivaciesChange("public")}
/>
<CustomInput
inline
type="checkbox"
name="allowedPrivacies"
id="privacy-private"
label="Private"
value="private"
checked={schedule.allowedPrivacies.includes("private")}
onChange={(e) => handleAllowedPrivaciesChange("private")}
/>
</div>
</ScheduleEditorRow>
<ScheduleEditorRow label="Availability">
{isNew ? (
<div>
Expand Down
1 change: 1 addition & 0 deletions src/components/ScheduleEditor/helpers/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export const getScheduleDefaultValues = () => {
priceDeltaType: "",
times: [],
timeRanges: [],
allowedPrivacies: ["public", "private"],
};
};