Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Log Entry / Calendar Symptom Shark Components #110

Merged
merged 33 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
87cb2c1
Start on symptom shark log entry component
Sep 6, 2023
1e4d49b
Various simplifications and refactoring for log entry
Sep 6, 2023
16c0218
Fix up some small issues
Sep 6, 2023
1fcac2f
Various tweaks and simplifications
Sep 6, 2023
4765a65
Symptom Shark today CTA
Sep 6, 2023
9cb4f50
Add notes input and start on log entry edit
Sep 6, 2023
f83671c
Add an option select variant to segmented control
Sep 6, 2023
2c5afe5
Work on generalizing symptom log edit
Sep 6, 2023
6a56c69
Add symptom log edit stuff
Sep 7, 2023
8e90bf2
Start moving in setup step stuff
Sep 7, 2023
81cd8ff
Remove setup step for now...not ready
Sep 8, 2023
4217fd6
Add log entry list
Sep 8, 2023
165d54c
Do exports
Sep 8, 2023
cd95dd2
Major restructuring for organization
Sep 8, 2023
9273176
Add symptom treatment histograms
Sep 8, 2023
1643632
Add the overall experience chart
Sep 8, 2023
92a2749
Add symptom severity chart
Sep 9, 2023
bb4a0c8
Add symptom treatment filters
Sep 9, 2023
ee61a92
Fix main treatment filters
Sep 9, 2023
4417dd9
Fixing a couple issues with visualization coordinator
Sep 9, 2023
9b05b84
Add calendar
Sep 11, 2023
b7150bb
Use more context
Sep 11, 2023
3c24de2
Adding the calendar view and tweaking a few things
Sep 11, 2023
9ec12b7
CSS Cleanup
Sep 11, 2023
3e1d185
Add symptom detail view and log entry edit view, symptom severity sum…
Sep 11, 2023
6e91196
Fix calendar viz
Sep 11, 2023
05e51d3
Merge branch 'main' into SymptomShark
Sep 27, 2023
e5620a3
Review comments on notes
Sep 27, 2023
b2efb3c
Add innerRef to components
Sep 27, 2023
f70461f
More efficient average calculation
Sep 27, 2023
c1cfa6f
Formatting, fix empty file
Sep 27, 2023
cef2890
auto color scheme
Sep 27, 2023
29168ff
Remove redundant layout
Sep 27, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { add } from "date-fns";

export default { title: "Container/DailyDataChart", component: DailyDataChart, parameters: { layout: 'fullscreen' } };
let render = (args: DailyDataChartProps) => <Layout colorScheme="auto"><Card><DailyDataChart {...args} /></Card></Layout>

export const stepsLineChart = {
args: {
title: "Steps",
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './presentational';
export * from './container';
export * from './symptom-shark';
export * from './view';
export * from './step';
6 changes: 5 additions & 1 deletion src/components/presentational/Action/Action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ActionProps {
icon?: ReactElement
subtitle?: string;
indicatorIcon?: IconDefinition;
indicator?: ReactElement;
onClick: Function;
children?: React.ReactNode;
className?: string;
Expand Down Expand Up @@ -46,7 +47,10 @@ export default function (props: ActionProps) {
{props.indicatorValue}&nbsp;
</span>
}
<FontAwesomeSvgIcon icon={indicatorIcon} />
{props.indicator}
{!props.indicator &&
greinard marked this conversation as resolved.
Show resolved Hide resolved
<FontAwesomeSvgIcon icon={indicatorIcon} />
}
</div>
</UnstyledButton>
);
Expand Down
3 changes: 2 additions & 1 deletion src/components/presentational/Calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface CalendarProps {
year: number,
dayRenderer(year: number, month: number, day?: number): JSX.Element | null,
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6
className?: string
innerRef?: React.Ref<HTMLDivElement>
}

Expand Down Expand Up @@ -70,7 +71,7 @@ export default function (props: CalendarProps) {
generateWeeks();

return (
<div ref={props.innerRef} className="mdhui-calendar">
<div ref={props.innerRef} className={"mdhui-calendar" + (props.className ? ` ${props.className}` : "")}>
<table cellPadding="0" cellSpacing="0">
<thead>
<tr>
Expand Down
17 changes: 17 additions & 0 deletions src/components/presentational/Card/Card.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,21 @@

.mdhui-card.allow-overflow {
overflow: visible;
}

.mdhui-card-subtle {
box-shadow: none;
background: none !important;
border: solid 1px var(--mdhui-border-color-1);
}

.mdhui-card-highlight
{
background: var(--mdhui-color-primary);
color: #FFF;
--mdhui-text-color-0: #FFF;
--mdhui-text-color-1: #FFF;
--mdhui-text-color-2: #FFF;
--mdhui-text-color-3: #FFF;
--mdhui-text-color-4: #FFF;
}
3 changes: 2 additions & 1 deletion src/components/presentational/Card/Card.stories.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.card-story-primary {
background-color: cornflowerblue;
}
}

57 changes: 32 additions & 25 deletions src/components/presentational/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,47 @@
import React from "react";
import { ComponentStory, ComponentMeta } from "@storybook/react";
import Action, { ActionProps } from "../Action/Action";
import Action from "../Action/Action";
import Layout from "../Layout"
import Card, { CardProps } from "./Card"
import CardTitle from "../CardTitle/CardTitle";
import "./Card.stories.css";

export default {
title: "Presentational/Card",
component: Action,
component: Card,
parameters: {
layout: 'fullscreen',
}
} as ComponentMeta<typeof Action>;
};

let render = (args: CardProps) => <Layout><Card {...args} /></Layout>

export const CardAction = {
args: {
children: <Action onClick={() => {}} title="Baseline Survey" subtitle="Tap here to start your baseline survey" />
},
render: render
};


const Template: ComponentStory<typeof Action> = (args: ActionProps) =>
<Layout colorScheme="auto">
<Card>
<Action {...args} />
</Card>
</Layout>;
export const CardWithClass = {
args: {
className: "card-story-primary",
children: <Action onClick={() => {}} title="Baseline Survey" subtitle="Tap here to start your baseline survey" />
},
render: render
};

export const CardAction = Template.bind({});
CardAction.args = {
title: "Baseline Survey",
subtitle: "Tap here to start your baseline survey"
export const SubtleVariant = {
args: {
variant: "subtle",
children: <Action onClick={() => {}} title="Baseline Survey" subtitle="Tap here to start your baseline survey" />
},
render: render
};

const CardTemplate: ComponentStory<typeof Card> = (args: CardProps) =>
<Layout colorScheme="auto">
<Card {...args}>
<CardTitle title="Card Title" />
<div style={{ padding: "16px" }}>Card Content</div>
</Card>
</Layout>;
export const CardWithClass = CardTemplate.bind({});
CardWithClass.args = {
className: "card-story-primary"
export const HighlightVariant = {
args: {
variant: "highlight",
children: <Action onClick={() => {}} title="Baseline Survey" subtitle="Tap here to start your baseline survey" />
},
render: render
};
8 changes: 8 additions & 0 deletions src/components/presentational/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from 'react';
import "./Card.css"
import ShinyOverlay from '../ShinyOverlay/ShinyOverlay';

export interface CardProps {
className?: string;
children?: React.ReactNode;
allowOverflow?: boolean;
innerRef?: React.Ref<HTMLDivElement>;
variant?: "default" | "subtle" | "highlight";
}

export default function (props: CardProps) {
Expand All @@ -20,10 +22,16 @@ export default function (props: CardProps) {
if (props.className) {
classes.push(props.className);
}
let variant = props.variant || "default";
classes.push(`mdhui-card-${variant}`);
if(variant == "highlight"){
classes.push("mdhui-color-scheme-dark");
}

return (
<div ref={props.innerRef} className={classes.join(" ")}>
{props.children}
{props.children && variant === "highlight" && <ShinyOverlay />}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DateRangeNavigator from "../DateRangeNavigator/DateRangeNavigator";
import { WeekStartsOn, getMonthStart, getWeekStart } from "../../../helpers/get-interval-start";

export interface DateRangeCoordinatorProps {
initialIntervalStart?: Date;
intervalType: "Week" | "Month";
weekStartsOn?: WeekStartsOn;
variant?: "default" | "rounded";
Expand All @@ -19,7 +20,7 @@ export interface DateRangeContext {
export const DateRangeContext = createContext<DateRangeContext | null>(null);

export default function DateRangeNavigatorContext(props: DateRangeCoordinatorProps) {
let initialIntervalStart = getMonthStart();
let initialIntervalStart = props.initialIntervalStart || getMonthStart();
if (props.intervalType === "Week") {
initialIntervalStart = getWeekStart(props.weekStartsOn);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.mdhui-card .mdhui-date-range-navigator:first-child {
border-radius: 5px 5px 0px 0px;
border-radius: var(--mdhui-card-border-radius) var(--mdhui-card-border-radius) 0px 0px;
}

.mdhui-date-range-navigator {
Expand Down
89 changes: 44 additions & 45 deletions src/components/presentational/DayTrackerSymbol/DayTrackerSymbol.css
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
.mdhui-day-tracker-symbol
{
.mdhui-day-tracker-symbol {
padding: 10px;
}

.mdhui-day-tracker-symbol .day-circle
{
font-size: 12px;
height: 30px;
width: 30px;
display: inline-block;
border-radius: 17px;
line-height: 30px;
background: var(--mdhui-background-color-2);
position: relative;
}
.mdhui-day-tracker-symbol .day-circle {
font-size: 12px;
height: 30px;
width: 30px;
display: inline-block;
border-radius: 17px;
line-height: 30px;
background: var(--mdhui-background-color-2);
position: relative;
}

.mdhui-day-tracker-symbol .day-circle .secondary-color
{
position: absolute;
width: 8px;
height: 8px;
border-radius: 50%;
}
.mdhui-day-tracker-symbol .day-circle .secondary-color {
position: absolute;
width: 8px;
height: 8px;
border-radius: 50%;
}

.mdhui-day-tracker-symbol .day-circle .secondary-color:first-child
{
left: 36.6%;
top: -33.33%;
}
.mdhui-day-tracker-symbol .day-circle .secondary-color:first-child {
left: 36.6%;
top: -33.33%;
}

.mdhui-day-tracker-symbol .day-circle .secondary-color:nth-child(2)
{
left: 0%;
top: -23.333%;
}
.mdhui-day-tracker-symbol .day-circle .secondary-color:nth-child(2) {
left: 0%;
top: -23.333%;
}

.mdhui-day-tracker-symbol .day-circle .secondary-color:nth-child(3)
{
left: 73%;
top: -23.333%;
}
.mdhui-day-tracker-symbol .day-circle .secondary-color:nth-child(3) {
left: 73%;
top: -23.333%;
}

.mdhui-day-tracker-symbol .day-circle .more-items {
position: absolute;
left: 30px;
top: 0px;
font-size: 10px;
height: 8px;
width: 7px;
line-height: 6px;
}

.mdhui-day-tracker-symbol .day-circle .more-items
{
position: absolute;
left: 30px;
top: 0px;
font-size: 10px;
height: 8px;
width: 7px;
line-height: 6px;
}
.mdhui-day-tracker-symbol.mdhui-day-tracker-symbol-large {
transform: scale(2);
padding-top: 34px;
padding-bottom: 22px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ export interface DayTrackerSymbolProps {
primaryColors: string[]
secondaryColors: string[]
className?: string
innerRef?: React.Ref<HTMLDivElement>;
size?: "small" | "large"
innerRef?: React.Ref<HTMLDivElement>
}

export default function (props: DayTrackerSymbolProps) {
Expand All @@ -25,8 +26,16 @@ export default function (props: DayTrackerSymbolProps) {

var style = { background: background };

let classes = ["mdhui-day-tracker-symbol"];
if (props.className) {
classes.push(props.className);
}
if (props.size == "large") {
classes.push("mdhui-day-tracker-symbol-large");
}

return (
<div ref={props.innerRef} className={"mdhui-day-tracker-symbol " + (props.className || "")}>
<div ref={props.innerRef} className={classes.join(" ")}>
<div className="day-circle" style={style}>
{props.secondaryColors.slice(0, 3).map((color, index) =>
<div key={index} className="secondary-color" style={{ background: color }}></div>
Expand Down
20 changes: 20 additions & 0 deletions src/components/presentational/NotesInput/NotesInput.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.notes-input {
width: 100%;
text-align: left;
border: 0;
font-size: .88em;
border: none;
font-family: Helvetica, Arial, sans-serif;
padding-top: 16px;
resize: none;
background: var(--mdhui-background-color-2);
border-radius: var(--mdhui-card-border-radius);
padding: 16px;
box-sizing: border-box;
border: solid 1px var(--mdhui-color-primary);
overflow: hidden;
-webkit-appearance: none;
box-shadow: none !important;
color: var(--mdhui-text-color-1);
margin-bottom: 16px;
}
32 changes: 32 additions & 0 deletions src/components/presentational/NotesInput/NotesInput.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React, { useState } from "react";
import Layout from "../Layout";
import NotesInput, { NotesInputProps } from "./NotesInput";
import Section from "../Section";

export default {
title: "Presentational/NotesInput",
component: NotesInput,
parameters: {
layout: 'fullscreen',
}
};

export function Default() {
const [notes, setNotes] = useState("");

return <Layout colorScheme="auto">
<Section>
<NotesInput placeholder="Add notes" value={notes} onChange={(n) => setNotes(n)} />
</Section>
</Layout>
}

export function AutoTimestamp() {
const [notes, setNotes] = useState("");

return <Layout colorScheme="auto">
<Section>
<NotesInput placeholder="Add notes" autoTimestamp value={notes} onChange={(n) => setNotes(n)} />
</Section>
</Layout>
}
Loading