Skip to content

Commit

Permalink
feat: print transcript
Browse files Browse the repository at this point in the history
  • Loading branch information
getnashty committed Apr 18, 2023
1 parent 2c7e99b commit 1e7c0c4
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/lib/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface Options {
relativeTimestamps?: boolean;
showAudioPlayer?: boolean;
showCompanyFilter?: boolean;
showExport?: boolean;
showPriceReaction?: boolean;
showRecordingDetails?: boolean;
showScheduleRecording?: boolean;
Expand Down
27 changes: 27 additions & 0 deletions src/modules/Transcript/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function HeaderUI(props: HeaderUIProps): ReactElement {

const config = useConfig();
let showPriceReaction = true;
let showExport = true;
let showTitleInfo = true;
let showRecordingDetails = true;
let showSearch = !hideSearch;
Expand All @@ -108,6 +109,9 @@ export function HeaderUI(props: HeaderUIProps): ReactElement {
if (config.options.showSearch !== undefined) {
showSearch = config.options.showSearch;
}
if (config.options.showExport !== undefined) {
showExport = config.options.showExport;
}
}

return (
Expand Down Expand Up @@ -360,6 +364,29 @@ export function HeaderUI(props: HeaderUIProps): ReactElement {
startTime={startTime}
/>
)}
{showExport && headerExpanded && event && (
<div
className={classNames(
'flex flex-col justify-start border-t-[1px] border-gray-100 px-3 dark:border-bluegray-5',
'transcript__header__details'
)}
>
<div className="flex items-center justify-between h-10 cursor-pointer">
<span className="text-sm block font-semibold w-28 mr-1 dark:text-white">
Export Transcript
</span>
<div
onClick={() => window.print()}
className={classNames(
'text-gray-400 text-sm hover:text-gray-600',
'bg-gray-100 hover:bg-gray-200 rounded-md px-2 py-1'
)}
>
Print
</div>
</div>
</div>
)}
</>
);
})
Expand Down
6 changes: 5 additions & 1 deletion src/modules/Transcript/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ export const TranscriptUI = (props: TranscriptUIProps): ReactElement => {
</div>
))
.otherwise(() => null)}
<div className="overflow-y-scroll flex-1 bg-gray-50 dark:bg-bluegray-7" ref={scrollContainerRef}>
<div
id="transcriptContainer"
className="overflow-y-scroll flex-1 bg-gray-50 dark:bg-bluegray-7"
ref={scrollContainerRef}
>
{match(eventQuery)
.with({ status: 'loading' }, () =>
new Array(5).fill(0).map((_, idx) => (
Expand Down
24 changes: 24 additions & 0 deletions src/modules/Transcript/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@media print {
body * {
visibility: hidden;
}
.transcript__header__title *:not(button) {
@apply text-lg;
visibility: visible;
}
.transcript__header__title {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
}
#transcriptContainer * {
visibility: visible;
}
#transcriptContainer {
position: absolute;
top: 80px;
left: 0px;
right: 0px;
}
}
3 changes: 2 additions & 1 deletion src/web/demo/EventByTicker.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
options: {
ticker: 'aapl',
darkMode: false,
showTitleInfo: false,
showTitleInfo: true,
showRecordingDetails: true,
showPriceReaction: true,
showSearch: true,
showAudioPlayer: false,
showExport: true,
},
user: {
//email: '[email protected]',
Expand Down

0 comments on commit 1e7c0c4

Please sign in to comment.