-
Notifications
You must be signed in to change notification settings - Fork 816
[dashboards] CRM UI for Dashboard Pro + crm-quick-start recipe #402
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
Open
alanshurafa
wants to merge
5
commits into
NateBJones-Projects:main
Choose a base branch
from
alanshurafa:upstream/dash-crm-ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
158fe85
[integrations] smart-ingest: handle UUID thought/job ids
alanshurafa 81755e0
[integrations] smart-ingest: README job_id examples to UUID
alanshurafa 23d8da0
Merge remote-tracking branch 'origin/main' into HEAD
alanshurafa 241a5e5
[integrations] smart-ingest: fix dashboard-next gateway link
alanshurafa ad7b3b8
[dashboards] CRM UI for Dashboard Pro + crm-quick-start recipe
alanshurafa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
132 changes: 132 additions & 0 deletions
132
dashboards/open-brain-dashboard-pro/app/contacts/[id]/AddMethodForm.tsx
This file contains hidden or 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,132 @@ | ||
| "use client"; | ||
|
|
||
| import { useActionState, useState } from "react"; | ||
|
|
||
| // The server action returns one of these; `undefined` is the initial state. | ||
| export type AddMethodResult = { ok: true } | { error: string } | undefined; | ||
|
|
||
| // Common method types. The truth layer accepts arbitrary strings, so "other" | ||
| // falls back to a free-text input for anything not in the list. | ||
| const METHOD_TYPES = ["email", "phone", "address", "handle", "url", "other"]; | ||
|
|
||
| export function AddMethodForm({ | ||
| contactId, | ||
| action, | ||
| }: { | ||
| contactId: string; | ||
| action: (prev: AddMethodResult, formData: FormData) => Promise<AddMethodResult>; | ||
| }) { | ||
| const [open, setOpen] = useState(false); | ||
| const [type, setType] = useState("email"); | ||
| const [state, formAction, pending] = useActionState( | ||
| async (prev: AddMethodResult, formData: FormData) => { | ||
| const result = await action(prev, formData); | ||
| if (result && "ok" in result && result.ok) { | ||
| setOpen(false); | ||
| setType("email"); | ||
| } | ||
| return result; | ||
| }, | ||
| undefined | ||
| ); | ||
|
|
||
| if (!open) { | ||
| return ( | ||
| <div className="px-4 py-3 border-t border-border"> | ||
| <button | ||
| type="button" | ||
| onClick={() => setOpen(true)} | ||
| className="text-xs text-text-muted hover:text-violet transition-colors" | ||
| > | ||
| + Add method | ||
| </button> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| return ( | ||
| <form action={formAction} className="px-4 py-3 border-t border-border space-y-3"> | ||
| <input type="hidden" name="id" value={contactId} /> | ||
| <div className="flex flex-wrap items-end gap-2"> | ||
| <div> | ||
| <label htmlFor="method_type" className="block text-text-muted text-xs uppercase tracking-wider mb-1"> | ||
| Type | ||
| </label> | ||
| <select | ||
| id="method_type" | ||
| name="method_type" | ||
| value={type} | ||
| onChange={(e) => setType(e.target.value)} | ||
| className="px-3 py-1.5 bg-bg-elevated border border-border rounded text-text-primary text-sm focus:outline-none focus:border-violet focus:ring-1 focus:ring-violet/30 transition" | ||
| > | ||
| {METHOD_TYPES.map((t) => ( | ||
| <option key={t} value={t}> | ||
| {t} | ||
| </option> | ||
| ))} | ||
| </select> | ||
| </div> | ||
| {type === "other" && ( | ||
| <div> | ||
| <label htmlFor="method_type_custom" className="block text-text-muted text-xs uppercase tracking-wider mb-1"> | ||
| Custom type | ||
| </label> | ||
| <input | ||
| id="method_type_custom" | ||
| name="method_type_custom" | ||
| placeholder="e.g. fax" | ||
| className="px-3 py-1.5 bg-bg-elevated border border-border rounded text-text-primary text-sm placeholder-text-muted focus:outline-none focus:border-violet focus:ring-1 focus:ring-violet/30 transition" | ||
| /> | ||
| </div> | ||
| )} | ||
| <div className="flex-1 min-w-[12rem]"> | ||
| <label htmlFor="value" className="block text-text-muted text-xs uppercase tracking-wider mb-1"> | ||
| Value | ||
| </label> | ||
| <input | ||
| id="value" | ||
| name="value" | ||
| required | ||
| placeholder="ada@example.com" | ||
| className="w-full px-3 py-1.5 bg-bg-elevated border border-border rounded text-text-primary text-sm placeholder-text-muted focus:outline-none focus:border-violet focus:ring-1 focus:ring-violet/30 transition" | ||
| /> | ||
| </div> | ||
| <div> | ||
| <label htmlFor="label" className="block text-text-muted text-xs uppercase tracking-wider mb-1"> | ||
| Label | ||
| </label> | ||
| <input | ||
| id="label" | ||
| name="label" | ||
| placeholder="work (optional)" | ||
| className="px-3 py-1.5 bg-bg-elevated border border-border rounded text-text-primary text-sm placeholder-text-muted focus:outline-none focus:border-violet focus:ring-1 focus:ring-violet/30 transition" | ||
| /> | ||
| </div> | ||
| </div> | ||
|
|
||
| <label className="flex items-center gap-2 text-text-secondary text-sm"> | ||
| <input type="checkbox" name="is_primary" value="true" className="accent-violet" /> | ||
| Primary | ||
| </label> | ||
|
|
||
| {state && "error" in state && <p className="text-danger text-xs">{state.error}</p>} | ||
|
|
||
| <div className="flex items-center gap-2"> | ||
| <button | ||
| type="submit" | ||
| disabled={pending} | ||
| className="text-xs px-3 py-1.5 rounded bg-violet hover:bg-violet-dim text-white transition-colors disabled:opacity-50 disabled:cursor-not-allowed" | ||
| > | ||
| {pending ? "Adding…" : "Add method"} | ||
| </button> | ||
| <button | ||
| type="button" | ||
| onClick={() => setOpen(false)} | ||
| className="text-xs px-3 py-1.5 rounded border border-border text-text-muted hover:text-text-primary transition-colors" | ||
| > | ||
| Cancel | ||
| </button> | ||
| </div> | ||
| </form> | ||
| ); | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Dashboard Pro now rejects
/api/ingest/1locally, but the committed smart-ingest schema still creates numericingestion_jobs.idvalues and the REST gateway still exposes/ingestion-jobs/(\d+)(integrations/rest-api/index.ts:325-336). When/ingestreturns a numeric dry-runjob_id, the AddToBrain preview calls this route and getsInvalid idbefore it can fetch details or reach the execute route, so numeric job ids need to remain valid unless the backend schema/routes are changed together.Useful? React with 👍 / 👎.