Skip to content

Commit bbca128

Browse files
committed
remove unused code from formatting.tsx
1 parent 23d0f44 commit bbca128

File tree

1 file changed

+0
-56
lines changed

1 file changed

+0
-56
lines changed

components/formatting.tsx

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import { Timestamp } from "firebase/firestore"
2-
import { useMediaQuery } from "usehooks-ts"
3-
import { Testimony } from "../functions/src/testimony/types"
4-
import { Bill, BillContent } from "./db"
5-
61
const billIdFormat = /^(?<chamber>\D+)(?<number>\d+)$/
72

83
/** Formats H123 as H.123 */
@@ -15,56 +10,5 @@ export const formatBillId = (id: string) => {
1510
}
1611
}
1712

18-
const MISSING_TIMESTAMP = Timestamp.fromMillis(0)
19-
export const formatTimestamp = (t?: Timestamp) => {
20-
if (!t || t.toMillis() == MISSING_TIMESTAMP.toMillis()) {
21-
return undefined
22-
}
23-
return t.toDate().toLocaleDateString()
24-
}
25-
26-
export const FormattedBillTitle = ({ bill }: { bill: Bill | BillContent }) => {
27-
const isMobile = useMediaQuery("(max-width: 768px)")
28-
const billInfo = "content" in bill ? bill.content : bill
29-
30-
const { BillNumber, Title } = billInfo
31-
32-
return (
33-
<div className="mt-2">
34-
{formatBillId(BillNumber)}:{" "}
35-
{isMobile ? Title.substring(0, 45) + "..." : Title}
36-
</div>
37-
)
38-
}
39-
40-
export const FormattedTestimonyTitle = ({
41-
testimony
42-
}: {
43-
testimony: Testimony
44-
}) => {
45-
const { authorDisplayName, publishedAt, position } = testimony
46-
47-
return (
48-
<div>
49-
<span>
50-
<b>Author:</b> {authorDisplayName || "anonymous"}
51-
</span>
52-
<br></br>
53-
<span>
54-
<b>Published on:</b> {publishedAt.toDate().toLocaleDateString()}
55-
</span>
56-
<br></br>
57-
<span>
58-
<b>Position:</b> {position}
59-
</span>
60-
</div>
61-
)
62-
}
63-
64-
export const decodeHtmlCharCodes = (s: string) =>
65-
s.replace(/(&#(\d+);)/g, (match, capture, charCode) =>
66-
String.fromCharCode(charCode)
67-
)
68-
6913
export const truncateText = (s: string | undefined, maxLength: number) =>
7014
!!s && s.length > maxLength ? s.substring(0, maxLength) + "..." : s

0 commit comments

Comments
 (0)