Skip to content

Commit 62247db

Browse files
Merge pull request #308 from cmu15122/azhang45_announcementLinks
announcements automatically hyperlink URLs
2 parents c728afd + fba738a commit 62247db

File tree

5 files changed

+66
-2
lines changed

5 files changed

+66
-2
lines changed

.env.local

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Deployment used by `npx convex dev`
2+
CONVEX_DEPLOYMENT=local:local-jackson_romero-q_prime # team: jackson-romero, project: q-prime
3+
4+
CONVEX_URL=http://127.0.0.1:3210

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ web_modules/
7171
# dotenv environment variables file
7272
.env
7373
.env.test
74+
.env.local
7475

7576
# parcel-bundler cache (https://parceljs.org/)
7677
.cache

client/package-lock.json

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
"chart.js": "^4.4.1",
2424
"chat.js": "^1.0.2",
2525
"downloadjs": "^1.4.7",
26+
"linkify-html": "^4.3.2",
27+
"linkify-react": "^4.3.2",
28+
"linkifyjs": "^4.3.2",
2629
"luxon": "^2.4.0",
2730
"material-react-toastify": "^1.0.1",
2831
"number-to-words": "^1.2.4",

client/src/components/home/shared/Annoucements.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import {
77
Edit, Delete,
88
} from '@mui/icons-material';
99

10+
import Linkify from 'linkify-react';
11+
1012
import AnnouncementDialogBody from './dialogs/AnnouncementDialogBody';
1113
import AddDialog from '../../common/dialogs/AddDialog';
1214
import EditDialog from '../../common/dialogs/EditDialog';
@@ -130,8 +132,17 @@ export default function Announcements(props) {
130132
{rows.slice().reverse().map((row, index) => (
131133
<ItemRow key={row.id} index={index} rowKey={row.id}>
132134
<TableCell component='th' scope='row' sx={{pl: 3.25}}>
133-
<Typography sx={{fontWeight: 'bold', whiteSpace: 'pre-line'}}>
134-
{row.content}
135+
<Typography
136+
sx={{
137+
'fontWeight': 'bold',
138+
'whiteSpace': 'pre-line',
139+
'& a': {
140+
color: 'primary.main',
141+
cursor: 'pointer',
142+
},
143+
}}
144+
>
145+
<Linkify options={{target: '_blank'}}>{row.content}</Linkify>
135146
</Typography>
136147
</TableCell>
137148
<TableCell>

0 commit comments

Comments
 (0)