import { Callback, NLView } from "../types"; import { Col, Drawer, Form } from "antd"; import { ItemGrid } from "./ItemGrid"; import { LeftCircleOutlined, RightCircleOutlined } from "@ant-design/icons"; import { MoodCreateModal } from "../Pages/Mood/MoodCreate"; import { MoodFolderWidget, MoodWidget } from "./MoodWidget"; import { MoodReadResponse } from "@newstackdev/iosdk-newgraph-client-js"; import { MoodsGrid } from "../Pages/Mood/MoodsGrid"; import { ProgressButton } from "./ProgressButton"; import { ScrollMenu } from "react-horizontal-scrolling-menu"; import { omit } from "lodash"; import { useAppState } from "../overmind"; import { useRef, useState } from "react"; import Title from "../Pages/Explore/Title"; export const SelectMood: NLView<{ moods?: MoodReadResponse[]; onChange?: (moods: MoodReadResponse[]) => void; value?: MoodReadResponse[]; limit?: number; title?: string; deeplikeActions?: boolean; deepLikeContainer?: React.MutableRefObject; }> = ({ moods, onChange, limit, title, deeplikeActions, deepLikeContainer }) => { const [_value, _setValue] = useState>({}); const state = useAppState(); const filteredMoods = state.api.auth.moods.filter( () => true, // (m) => m.title !== "My uploads" ); const checkMoods = moods === undefined ? filteredMoods || [] : moods.filter((m) => m.title !== "My uploads"); const toggle = (ni: { id?: string }) => { if (!ni.id) return; const nv = _value[ni.id || ""] ? { ...omit(_value, [ni.id]) } : { ..._value, [ni.id]: ni }; _setValue(nv); onChange && onChange(Object.values(nv)); }; const createMood = (
v?.id && toggle(v)} />
); return ( { return !index ? ( createMood ) : ( toggle(m)} selected={!!_value[(m as any).id || ""]} /> ); }} /> ); // return toggle(m)} selected={!!value[(m as any).id || ""]} />} /> // return // { // moods.length ? moods.map(m => ( //
toggle(m)} selected={!!value[m.id || ""]} />
// )) :

no moods

// } //
}; export const SelectMoodForm: NLView<{ title?: string; onFinish: Callback; deeplikeActions?: boolean; setVisible?: React.Dispatch>; visible?: boolean; }> = ({ title, onFinish, deeplikeActions, setVisible, visible }) => { return (
<Form.Item name="moods" style={{ margin: 0 }}> <SelectMood title={title} deeplikeActions={deeplikeActions} limit={6} /> </Form.Item> {/* //TODO uncomment - needed action to finish the process*/} {/* <Form.Item label="" wrapperCol={{ offset: 0, span: 24 }} className="text-right"> <ProgressButton actionName="api.post.attachToMoods" type="primary" htmlType="submit" progressText="Adding to moods..."> Share </ProgressButton> </Form.Item> */} </Form> </div> ); };