-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* basic editing working
- Loading branch information
Showing
9 changed files
with
164 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createSupabaseDirectClient } from 'shared/supabase/init' | ||
import { log } from 'shared/utils' | ||
import { DashboardItemSchema } from 'shared/zod-types' | ||
import { z } from 'zod' | ||
import { authEndpoint, validate } from './helpers' | ||
|
||
const schema = z.object({ | ||
dashboardId: z.string(), | ||
items: z.array(DashboardItemSchema), | ||
}) | ||
|
||
export const updatedashboard = authEndpoint(async (req, auth) => { | ||
const { dashboardId, items } = validate(schema, req.body) | ||
|
||
log('creating dashboard') | ||
const pg = createSupabaseDirectClient() | ||
|
||
const updatedDashboard = await pg.one( | ||
`update dashboards | ||
set items = $1 | ||
where id = $2 and creator_id = $3 | ||
returning *`, | ||
[JSON.stringify(items), dashboardId, auth.uid] | ||
) | ||
|
||
// return updated dashboard | ||
return { updateDashboard: updatedDashboard } | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { | ||
DashboardItem, | ||
DashboardLinkItem, | ||
DashboardQuestionItem, | ||
} from 'common/dashboard' | ||
import { Row } from '../layout/row' | ||
import { DashboardAddContractButton } from './dashboard-add-contract-button' | ||
import { DashboardAddLinkButton } from './dashboard-add-link-button' | ||
|
||
export function AddDashboardItemWidget(props: { | ||
items: DashboardItem[] | ||
setItems: (items: DashboardItem[]) => void | ||
}) { | ||
const { items, setItems } = props | ||
|
||
return ( | ||
<Row className="border-ink-200 text-ink-400 items-center gap-4 rounded-lg border-2 border-dashed p-2"> | ||
<DashboardAddContractButton | ||
addQuestions={(questions: DashboardQuestionItem[]) => { | ||
setItems([...items, ...questions]) | ||
}} | ||
/> | ||
OR | ||
<DashboardAddLinkButton | ||
addLink={(link: DashboardLinkItem) => { | ||
setItems([...items, link]) | ||
}} | ||
/> | ||
</Row> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72ebdfb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
docs – ./docs
docs-mantic.vercel.app
docs-pi-teal.vercel.app
docs-git-main-mantic.vercel.app
docs.manifold.markets
72ebdfb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
dev – ./web
dev-git-main-mantic.vercel.app
dev-mantic.vercel.app
dev-manifold.vercel.app
dev.manifold.markets
72ebdfb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
prod – ./web
prod-git-main-mantic.vercel.app
prod-mantic.vercel.app
mantic.vercel.app
manifold.markets
www.manifold.markets