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
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"deploy": "gh-pages -d example/build"
},
"peerDependencies": {
"react": ">=16.8.0",
"antd": ">=4.0.0"
"antd": ">=4.0.0",
"yaml": "^2.1.1"
},
"devDependencies": {
"@babel/preset-react": "^7.18.6",
Expand Down Expand Up @@ -65,6 +65,7 @@
"number-to-words": "^1.2.4",
"rc-queue-anim": "^2.0.0",
"rc-texty": "^0.2.0",
"react-sizeme": "^3.0.2"
"react-sizeme": "^3.0.2",
"zod": "^3.22.2"
}
}
12 changes: 10 additions & 2 deletions src/cart-list/cart-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Divider, Empty, Tabs, Select, Checkbox,
Button, Dropdown, Menu, Tooltip, Anchor, Layout
} from 'antd'
import { ShoppingCartOutlined, DeleteOutlined, FolderAddOutlined, CopyOutlined, CaretDownOutlined, PlusOutlined } from '@ant-design/icons'
import { ShoppingCartOutlined, DeleteOutlined, FolderAddOutlined, CopyOutlined, CaretDownOutlined, PlusOutlined, UploadOutlined } from '@ant-design/icons'
import QueueAnim from 'rc-queue-anim'
import Texty from 'rc-texty'
import { SizeMe } from 'react-sizeme'
Expand Down Expand Up @@ -626,7 +626,7 @@ export const CartListLayout = ({
onCheckout=() => {},
cartListProps={}
}) => {
const { buckets, carts, activeCart, setActiveCart, updateCart, openCreateCartModal, openManageCartModal } = useShoppingCart()
const { buckets, carts, activeCart, setActiveCart, updateCart, openCreateCartModal, openImportCartModal, openManageCartModal } = useShoppingCart()

return (
<Layout className="cart-list-layout" style={{ height: 0 }}>
Expand All @@ -646,11 +646,19 @@ export const CartListLayout = ({
name: "Create new cart",
label: "Create new cart",
icon: <PlusOutlined />
},
{
key: "import-cart",
name: "Import cart",
label: "Import cart",
icon: <UploadOutlined />
}
]}
onSelect={ ({ key }) => {
if (key === "create-cart") {
openCreateCartModal()
} else if (key === "import-cart") {
openImportCartModal()
} else setActiveCart(key)
} }
/>
Expand Down
71 changes: 71 additions & 0 deletions src/dug-search-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/* eslint-disable prettier/prettier */

type APIError = {
detail: Array<{
loc: [string, number],
msg: string,
type: string,
}>
}

export type ConceptsResponseSuccess = {
message: string,
result: {
docs: Array<{
_source: {
id: string,
name: string,
description: string,
type: string,
search_terms: string[],
optional_terms: string[],
concept_action: string,
identifiers: Array<{
id: string,
label: string,
equivalent_identifiers: string[],
type: string,
synonyms: string[],
}>,
},
}>,
},
status: string,
}

export type StudiesResponseSuccess = {
message: string,
result: Array<{
c_id: string,
c_link: string,
c_name: string,
}>,
status: string,
}

export type VariablesResponseSuccess = {
message: string,
result: {
docs: Array<{
_source: {
element_id: string,
element_name: string,
element_desc: string,
search_terms: string[],
optional_terms: any[],
collection_id: string,
collection_name: string,
collection_desc: string,
element_action: string,
collection_action: string,
data_type: string,
identifiers: string[],
},
}>,
},
status: string,
}

export type ConceptsResponse = ConceptsResponseSuccess | APIError;
export type StudiesResponse = StudiesResponseSuccess | APIError;
export type VariablesResponse = VariablesResponseSuccess | APIError;
19 changes: 19 additions & 0 deletions src/modals/cart-modal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.import-modal-error-collapse .ant-collapse-header{
padding-left: 0px !important;
padding-right: 0px !important;
padding-bottom: 0px !important;
}

.import-modal-error-collapse .ant-collapse-content-box {
padding-left: 0px !important;
padding-right: 0px !important;
padding-bottom: 0px !important;
}

.import-modal-error-collapse .ant-collapse-content-box pre {
margin: 0px;
}

.import-modal-error-alert .ant-alert-close-icon {
display: none;
}
3 changes: 2 additions & 1 deletion src/modals/create-cart-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const CreateCartModalContent = ({ createShoppingCart, cartName, setCartNa
</Form.Item>
</Space>
<Paragraph>
Add items to a cart to...
The Shopping Cart is a feature to allow users to export a file of Dug
search results to take outside of Dug for further analyses.
</Paragraph>
</Space>
)
Expand Down
Loading