Feat/cal 95/date range on event types (#353)

* add edit links to events on dashboard

* fit elements on screen for mobile

* initialize components for consistent text styles

* add more fine grained width/height settings

* add higher level setting for when an event is available

- db: add supporting values to period allow setting an amount of days,
 a range, or unlimited number days an event is available

* fix issue where periodDates are null

* return minimal required data, handle date parsing

* [ui] limit booking days based on user period settings

* api: validate user period settings

* [db] migration for event type period settings
This commit is contained in:
Femi Odugbesan authored and GitHub committed 2021-07-15 09:10:26 -05:00
1 parent ecd0360d9a
commit 45689059c7
42 files changed
+1455 -380

No files matched your search

+3 -13
View File
@@ -70,7 +70,7 @@ export const Scheduler = ({
const OpeningHours = ({ idx, item }) => (
<li className="py-2 flex justify-between border-t">
<div className="inline-flex ml-2">
<div className="flex flex-col space-y-4 lg:inline-flex ml-2 ">
<WeekdaySelect defaultValue={item.days} onSelect={(selected: number[]) => (item.days = selected)} />
<button className="ml-2 text-sm px-2" type="button" onClick={() => setEditSchedule(idx)}>
{dayjs()
@@ -96,8 +96,8 @@ export const Scheduler = ({
return (
<div>
<div className="rounded border flex">
<div className="w-3/5">
<div className="w-3/4 p-2">
<div className="w-full">
<div className=" p-2">
<label htmlFor="timeZone" className="block text-sm font-medium text-gray-700">
Timezone
</label>
@@ -120,13 +120,6 @@ export const Scheduler = ({
Add another
</button>
</div>
<div className="border-l p-2 w-2/5 text-sm bg-gray-50">
{/*<p className="font-bold mb-2">Add date overrides</p>
<p className="mb-2">
Add dates when your availability changes from your weekly hours
</p>
<button className="btn-sm btn-white">Add a date override</button>*/}
</div>
</div>
{editSchedule >= 0 && (
<SetTimesModal
@@ -136,9 +129,6 @@ export const Scheduler = ({
onExit={() => setEditSchedule(-1)}
/>
)}
{/*{showDateOverrideModal &&
<DateOverrideModal />
}*/}
</div>
);
};
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Body: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--body"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Body;
+2
View File
@@ -0,0 +1,2 @@
import Body from "./Body";
export default Body;
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Caption: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--caption"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Caption;
+2
View File
@@ -0,0 +1,2 @@
import Caption from "./Caption";
export default Caption;
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Caption2: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--caption2"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Caption2;
+2
View File
@@ -0,0 +1,2 @@
import Caption2 from "./Caption2";
export default Caption2;
+11
View File
@@ -0,0 +1,11 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
const Footnote: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames("text--footnote", props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Footnote;
+2
View File
@@ -0,0 +1,2 @@
import Footnote from "./Footnote";
export default Footnote;
+11
View File
@@ -0,0 +1,11 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
const Headline: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames("text--headline", props?.className, props?.color);
return <h1 className={classes}>{props.children}</h1>;
};
export default Headline;
+2
View File
@@ -0,0 +1,2 @@
import Headline from "./Headline";
export default Headline;
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Largetitle: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--largetitle"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Largetitle;
+2
View File
@@ -0,0 +1,2 @@
import Largetitle from "./Largetitle";
export default Largetitle;
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Overline: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--overline"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Overline;
+2
View File
@@ -0,0 +1,2 @@
import Overline from "./Overline";
export default Overline;
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Subheadline: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--subheadline"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Subheadline;
+2
View File
@@ -0,0 +1,2 @@
import Subheadline from "./Subheadline";
export default Subheadline;
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Subtitle: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--subtitle"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Subtitle;
+2
View File
@@ -0,0 +1,2 @@
import Subtitle from "./Subtitle";
export default Subtitle;
+55
View File
@@ -0,0 +1,55 @@
/* strong {
@apply font-medium;
} */
.text {
}
.text--body {
@apply text-lg leading-relaxed;
}
.text--overline {
@apply text-sm uppercase font-semibold leading-snug tracking-wide;
}
.text--caption {
@apply text-sm text-gray-500 leading-tight;
}
.text--caption2 {
@apply text-xs italic text-gray-500 leading-tight;
}
.text--footnote {
@apply text-base font-normal;
}
.text--headline {
/* @apply text-base font-normal; */
@apply text-3xl leading-8 font-semibold tracking-tight text-gray-900 sm:text-4xl;
}
.text--subheadline {
@apply text-xl text-gray-500 leading-relaxed;
}
.text--largetitle {
@apply text-2xl font-normal;
}
.text--subtitle {
@apply text-base font-normal;
}
.text--title {
@apply text-base font-normal;
}
.text--title2 {
@apply text-base font-normal;
}
.text--title3 {
@apply text-xs font-semibold leading-tight;
}
+166
View File
@@ -0,0 +1,166 @@
import React from "react";
import Body from "./Body";
import Caption from "./Caption";
import Caption2 from "./Caption2";
import Footnote from "./Footnote";
import Headline from "./Headline";
import Largetitle from "./Largetitle";
import Overline from "./Overline";
import Subheadline from "./Subheadline";
import Subtitle from "./Subtitle";
import Title from "./Title";
import Title2 from "./Title2";
import Title3 from "./Title3";
import classnames from "classnames";
type Props = {
variant?:
| "overline"
| "caption"
| "body"
| "caption2"
| "footnote"
| "headline"
| "largetitle"
| "subheadline"
| "subtitle"
| "title"
| "title2"
| "title3";
children: any;
text?: string;
tx?: string;
className?: string;
color?: string;
};
export type TextProps = {
children: any;
text?: string;
tx?: string;
color?: string;
className?: string;
};
/**
* static let largeTitle: Font
* A font with the large title text style.
*
* static let title: Font
* A font with the title text style.
*
* static let title2: Font
* Create a font for second level hierarchical headings.
*
* static let title3: Font
* Create a font for third level hierarchical headings.
*
* static let headline: Font
* A font with the headline text style.
*
* static let subheadline: Font
* A font with the subheadline text style.
*
* static let body: Font
* A font with the body text style.
*
* static let callout: Font
* A font with the callout text style.
*
* static let caption: Font
* A font with the caption text style.
*
* static let caption2: Font
* Create a font with the alternate caption text style.
*
* static let footnote: Font
* A font with the footnote text style.
*/
const Text: React.FunctionComponent<Props> = (props: Props) => {
const classes = classnames(props?.className, props?.color);
switch (props?.variant) {
case "overline":
return (
<Overline className={classes} {...props}>
{props.children}
</Overline>
);
case "body":
return (
<Body className={classes} {...props}>
{props.children}
</Body>
);
case "caption":
return (
<Caption className={classes} {...props}>
{props.children}
</Caption>
);
case "caption2":
return (
<Caption2 className={classes} {...props}>
{props.children}
</Caption2>
);
case "footnote":
return (
<Footnote className={classes} {...props}>
{props.children}
</Footnote>
);
case "headline":
return (
<Headline className={classes} {...props}>
{props.children}
</Headline>
);
case "largetitle":
return (
<Largetitle className={classes} {...props}>
{props.children}
</Largetitle>
);
case "subheadline":
return (
<Subheadline className={classes} {...props}>
{props.children}
</Subheadline>
);
case "subtitle":
return (
<Subtitle className={classes} {...props}>
{props.children}
</Subtitle>
);
case "title":
return (
<Title className={classes} {...props}>
{props.children}
</Title>
);
case "title2":
return (
<Title2 className={classes} {...props}>
{props.children}
</Title2>
);
case "title3":
return (
<Title3 className={classes} {...props}>
{props.children}
</Title3>
);
default:
return (
<Body className={classes} {...props}>
{props.children}
</Body>
);
}
};
export default Text;
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Title: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--title"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Title;
+2
View File
@@ -0,0 +1,2 @@
import Title from "./Title";
export default Title;
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Title2: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--title2"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Title2;
+2
View File
@@ -0,0 +1,2 @@
import Title2 from "./Title2";
export default Title2;
+12
View File
@@ -0,0 +1,12 @@
import React from "react";
import classnames from "classnames";
import { TextProps } from "../Text";
import Styles from "../Text.module.css";
const Title3: React.FunctionComponent<TextProps> = (props: TextProps) => {
const classes = classnames(Styles["text--title3"], props?.className, props?.color);
return <p className={classes}>{props.children}</p>;
};
export default Title3;
+2
View File
@@ -0,0 +1,2 @@
import Title3 from "./Title3";
export default Title3;
+39
View File
@@ -0,0 +1,39 @@
import Text from "./Text";
export { Text };
export default Text;
import Title from "./Title";
export { Title };
import Title2 from "./Title2";
export { Title2 };
import Title3 from "./Title3";
export { Title3 };
import Largetitle from "./Largetitle";
export { Largetitle };
import Subtitle from "./Subtitle";
export { Subtitle };
import Headline from "./Headline";
export { Headline };
import Subheadline from "./Subheadline";
export { Subheadline };
import Caption from "./Caption";
export { Caption };
import Caption2 from "./Caption2";
export { Caption2 };
import Footnote from "./Footnote";
export { Footnote };
import Overline from "./Overline";
export { Overline };
import Body from "./Body";
export { Body };