Skip to content

Commit

Permalink
Email fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian-emilius committed Aug 27, 2024
1 parent 6725eaf commit 9ee10ea
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
26 changes: 16 additions & 10 deletions client/src/components/GanttChart/GanttChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
useState,
useEffect,
CSSProperties,
useRef,
} from 'react'
import { Button, Collapse, Group, Popover, RangeSlider, Text } from '@mantine/core'
import { formatDate } from '../../utils/format'
Expand Down Expand Up @@ -75,7 +76,7 @@ const GanttChart = (props: IGanttChartProps) => {
const [hoveredTimelineItem, setHoveredTimelineItem] = useState<string>()
const [hoveredEventItem, setHoveredEventItem] = useState<string>()

const [initialTouchDistance, setInitialTouchDistance] = useState<number>()
const initialTouch = useRef<{ initialDistance: number; initialRange: DateRange } | null>(null)

const currentTime = useMemo(() => Date.now(), [])

Expand Down Expand Up @@ -135,12 +136,12 @@ const GanttChart = (props: IGanttChartProps) => {
)

// Touch events for pinch to zoom
const zoomRange = (zoomFactor: number) => {
const center = (filteredRange[0] + filteredRange[1]) / 2
const zoomRange = (zoomFactor: number, currentRange: DateRange) => {
const center = (currentRange[0] + currentRange[1]) / 2

setRange([
Math.max(center - (center - filteredRange[0]) * zoomFactor, totalRange[0]),
Math.min(center + (filteredRange[1] - center) * zoomFactor, totalRange[1]),
Math.max(center - (center - currentRange[0]) * zoomFactor, totalRange[0]),
Math.min(center + (currentRange[1] - center) * zoomFactor, totalRange[1]),
])
}

Expand All @@ -152,23 +153,29 @@ const GanttChart = (props: IGanttChartProps) => {

const handleTouchStart = (e: TouchEvent<HTMLDivElement>) => {
if (e.touches.length === 2) {
setInitialTouchDistance(getTouchDistance(e.touches[0], e.touches[1]))
initialTouch.current = {
initialDistance: getTouchDistance(e.touches[0], e.touches[1]),
initialRange: filteredRange,
}
}
}

const handleTouchMove = (e: TouchEvent<HTMLDivElement>) => {
if (e.touches.length === 2 && initialTouchDistance) {
if (e.touches.length === 2 && initialTouch.current) {
const currentDistance = getTouchDistance(e.touches[0], e.touches[1])

zoomRange(currentDistance / initialTouchDistance)
zoomRange(
currentDistance / initialTouch.current.initialDistance,
initialTouch.current.initialRange,
)
}
}

const handleWheel = (e: WheelEvent<HTMLDivElement>) => {
if (e.ctrlKey) {
e.preventDefault()

zoomRange(e.deltaY < 0 ? 1.05 : 0.95)
zoomRange(e.deltaY < 0 ? 1.05 : 0.95, filteredRange)
}
}

Expand Down Expand Up @@ -299,7 +306,6 @@ const GanttChart = (props: IGanttChartProps) => {
onTouchStart={handleTouchStart}
onTouchMove={handleTouchMove}
onWheel={handleWheel}
style={{ touchAction: 'none' }}
>
{groups.map((group) => (
<div key={group.groupId} className={classes.groupRow}>
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/TopicPage/TopicPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const TopicPage = () => {
Manage Topics
</Button>
)}
<Button ml='auto' component={Link} to={`/submit-application/apply/${topic.topicId}`}>
<Button ml='auto' component={Link} to={`/submit-application/${topic.topicId}`}>
Apply Now
</Button>
</Group>
Expand Down
2 changes: 0 additions & 2 deletions server/mail-templates/thesis-closed.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,3 @@
<p>
Full Details: <a target="_blank" rel="noopener noreferrer nofollow" href="{{thesisUrl}}">{{thesisUrl}}</a>
</p>

{{config.signature}}
1 change: 0 additions & 1 deletion server/mail-templates/thesis-created.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
The next step is that you write a proposal and submit it on <a target="_blank" rel="noopener noreferrer nofollow" href="{{thesisUrl}}">{{thesisUrl}}</a>
</p>

{{config.signature}}
2 changes: 0 additions & 2 deletions server/mail-templates/thesis-final-grade.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@
<p>
Full Details: <a target="_blank" rel="noopener noreferrer nofollow" href="{{thesisUrl}}">{{thesisUrl}}</a>
</p>

{{config.signature}}
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void send(JavaMailSender mailSender, UploadService uploadService) throws
}

for (User recipient : primaryRecipients) {
if (primarySenders.contains(recipient)) {
if (primarySenders.contains(recipient) && secondaryRecipients.isEmpty()) {
continue;
}

Expand Down

0 comments on commit 9ee10ea

Please sign in to comment.