-
Notifications
You must be signed in to change notification settings - Fork 390
Allow share both #1393
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
Closed
Closed
Allow share both #1393
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
Some comments aren't visible on the classic Files Changed page.
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -51,11 +51,13 @@ interface ObsidianFolder { | |||||
} | ||||||
|
||||||
const exportHandlers = { | ||||||
copy: async (session: Session): Promise<ExportResult> => { | ||||||
copy: async (session: Session, isViewingRaw: boolean = false): Promise<ExportResult> => { | ||||||
try { | ||||||
let textToCopy = ""; | ||||||
|
||||||
if (session.enhanced_memo_html) { | ||||||
if (isViewingRaw && session.raw_memo_html) { | ||||||
textToCopy = html2md(session.raw_memo_html); | ||||||
} else if (!isViewingRaw && session.enhanced_memo_html) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enhanced note is skipped when isViewingRaw is true but raw content is missing, leading to empty copy operation. Prompt for AI agents
Suggested change
|
||||||
textToCopy = html2md(session.enhanced_memo_html); | ||||||
} else if (session.raw_memo_html) { | ||||||
textToCopy = html2md(session.raw_memo_html); | ||||||
|
@@ -71,8 +73,8 @@ const exportHandlers = { | |||||
} | ||||||
}, | ||||||
|
||||||
pdf: async (session: Session, theme: ThemeName = "default"): Promise<ExportResult> => { | ||||||
const path = await exportToPDF(session, theme); | ||||||
pdf: async (session: Session, theme: ThemeName = "default", isViewingRaw: boolean = false): Promise<ExportResult> => { | ||||||
const path = await exportToPDF(session, theme, isViewingRaw); | ||||||
if (path) { | ||||||
await message(`Meeting summary saved to your 'Downloads' folder ("${path}")`); | ||||||
} | ||||||
|
@@ -82,10 +84,13 @@ const exportHandlers = { | |||||
email: async ( | ||||||
session: Session, | ||||||
sessionParticipants?: Array<{ full_name: string | null; email: string | null }>, | ||||||
isViewingRaw: boolean = false, | ||||||
): Promise<ExportResult> => { | ||||||
let bodyContent = "Here is the meeting summary: \n\n"; | ||||||
|
||||||
if (session.enhanced_memo_html) { | ||||||
if (isViewingRaw && session.raw_memo_html) { | ||||||
bodyContent += html2md(session.raw_memo_html); | ||||||
} else if (!isViewingRaw && session.enhanced_memo_html) { | ||||||
bodyContent += html2md(session.enhanced_memo_html); | ||||||
} else if (session.raw_memo_html) { | ||||||
bodyContent += html2md(session.raw_memo_html); | ||||||
|
@@ -126,6 +131,7 @@ const exportHandlers = { | |||||
sessionTags: Tag[] | undefined, | ||||||
sessionParticipants: Array<{ full_name: string | null }> | undefined, | ||||||
includeTranscript: boolean = false, | ||||||
isViewingRaw: boolean = false, | ||||||
): Promise<ExportResult> => { | ||||||
const [baseFolder, apiKey, baseUrl] = await Promise.all([ | ||||||
obsidianCommands.getBaseFolder(), | ||||||
|
@@ -148,7 +154,14 @@ const exportHandlers = { | |||||
finalPath = await join(selectedFolder, filename); | ||||||
} | ||||||
|
||||||
let convertedMarkdown = session.enhanced_memo_html ? html2md(session.enhanced_memo_html) : ""; | ||||||
let convertedMarkdown = ""; | ||||||
if (isViewingRaw && session.raw_memo_html) { | ||||||
convertedMarkdown = html2md(session.raw_memo_html); | ||||||
} else if (!isViewingRaw && session.enhanced_memo_html) { | ||||||
convertedMarkdown = html2md(session.enhanced_memo_html); | ||||||
} else if (session.raw_memo_html) { | ||||||
convertedMarkdown = html2md(session.raw_memo_html); | ||||||
} | ||||||
|
||||||
// Add transcript if requested | ||||||
if (includeTranscript && session.words && session.words.length > 0) { | ||||||
|
@@ -328,13 +341,20 @@ export function useShareLogic() { | |||||
const { userId } = useHypr(); | ||||||
const param = useParams({ from: "/app/note/$id", shouldThrow: true }); | ||||||
const session = useSession(param.id, (s) => s.session); | ||||||
const showRaw = useSession(param.id, (s) => s.showRaw); | ||||||
|
||||||
const [expandedId, setExpandedId] = useState<string | null>(null); | ||||||
const [selectedObsidianFolder, setSelectedObsidianFolder] = useState<string>("default"); | ||||||
const [selectedPdfTheme, setSelectedPdfTheme] = useState<ThemeName>("default"); | ||||||
const [includeTranscript, setIncludeTranscript] = useState(false); | ||||||
const [copySuccess, setCopySuccess] = useState(false); | ||||||
|
||||||
// Determine what content is available and what to share | ||||||
const hasEnhancedNote = !!session?.enhanced_memo_html; | ||||||
const hasRawNote = !!session?.raw_memo_html; | ||||||
const hasShareableNote = hasEnhancedNote || hasRawNote; | ||||||
const isViewingRaw = showRaw || !hasEnhancedNote; | ||||||
const shareTitle = isViewingRaw ? "Share Raw Note" : "Share Enhanced Note"; | ||||||
|
||||||
const isObsidianConfigured = useQuery({ | ||||||
queryKey: ["integration", "obsidian", "enabled"], | ||||||
|
@@ -431,17 +451,17 @@ export function useShareLogic() { | |||||
let result: ExportResult | null = null; | ||||||
|
||||||
if (optionId === "copy") { | ||||||
result = await exportHandlers.copy(session); | ||||||
result = await exportHandlers.copy(session, isViewingRaw); | ||||||
} else if (optionId === "pdf") { | ||||||
result = await exportHandlers.pdf(session, selectedPdfTheme); | ||||||
result = await exportHandlers.pdf(session, selectedPdfTheme, isViewingRaw); | ||||||
} else if (optionId === "email") { | ||||||
try { | ||||||
// fetch participants directly, bypassing cache | ||||||
const freshParticipants = await dbCommands.sessionListParticipants(param.id); | ||||||
result = await exportHandlers.email(session, freshParticipants); | ||||||
result = await exportHandlers.email(session, freshParticipants, isViewingRaw); | ||||||
} catch (participantError) { | ||||||
console.warn("Failed to fetch participants, sending email without them:", participantError); | ||||||
result = await exportHandlers.email(session, undefined); | ||||||
result = await exportHandlers.email(session, undefined, isViewingRaw); | ||||||
} | ||||||
} else if (optionId === "obsidian") { | ||||||
sessionTags.refetch(); | ||||||
|
@@ -466,6 +486,7 @@ export function useShareLogic() { | |||||
sessionTagsData, | ||||||
sessionParticipantsData, | ||||||
includeTranscript, | ||||||
isViewingRaw, | ||||||
); | ||||||
} | ||||||
|
||||||
|
@@ -531,6 +552,9 @@ export function useShareLogic() { | |||||
return { | ||||||
session, | ||||||
hasEnhancedNote, | ||||||
hasShareableNote, | ||||||
shareTitle, | ||||||
isViewingRaw, | ||||||
expandedId, | ||||||
selectedObsidianFolder, | ||||||
setSelectedObsidianFolder, | ||||||
|
@@ -552,8 +576,9 @@ export function useShareLogic() { | |||||
} | ||||||
|
||||||
// Reusable Share Content Component | ||||||
export function SharePopoverContent() { | ||||||
export function SharePopoverContent({ shareTitle: propShareTitle }: { shareTitle?: string }) { | ||||||
const { | ||||||
shareTitle, | ||||||
expandedId, | ||||||
selectedObsidianFolder, | ||||||
setSelectedObsidianFolder, | ||||||
|
@@ -572,7 +597,7 @@ export function SharePopoverContent() { | |||||
|
||||||
return ( | ||||||
<div className="flex flex-col gap-3"> | ||||||
<div className="text-sm font-medium text-neutral-700">Share Enhanced Note</div> | ||||||
<div className="text-sm font-medium text-neutral-700">{propShareTitle || shareTitle}</div> | ||||||
<div className="flex flex-col gap-2"> | ||||||
{/* Direct action buttons */} | ||||||
{directActions.map((action) => { | ||||||
|
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
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.
🛠️ Refactor suggestion
Normalize suggested tag names more robustly and avoid empty tags
"@"
).Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents