Skip to content

Commit ab45beb

Browse files
committed
feat: print mode for syslog, renamed with redirects
- we moved year digits in front of the slug names for better organizing, also did redirects for them to avoid broken links - added print friendly mode for syslog, figured out it was more work to implement for the whole site
1 parent 9a3a881 commit ab45beb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+174
-23
lines changed

app/syslog/[slug]/global.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
/* Print styles */
3+
@media print {
4+
html {
5+
background-color: white;
6+
color: black;
7+
}
8+
9+
body {
10+
color: black;
11+
}
12+
13+
p, ul, ol, table {
14+
color: black;
15+
}
16+
17+
a {
18+
color: black;
19+
text-decoration: underline;
20+
}
21+
22+
table td, table th {
23+
border: 1px solid black;
24+
}
25+
26+
small, figcaption {
27+
color: black !important;
28+
}
29+
30+
a::after{
31+
content: " (" attr(href) ") ";
32+
}
33+
34+
.print-hide {
35+
display: none !important;
36+
}
37+
}
38+

app/syslog/[slug]/page.tsx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { userAgent } from 'next/server';
2828
import { headers } from 'next/headers';
2929
import { usePlausible } from 'next-plausible';
3030
import EditButton from './_components/EditPost';
31+
import './global.css';
3132

3233
export const dynamicParams = false;
3334
export const dynamic = 'force-static';
@@ -132,13 +133,15 @@ export default async function Page({ params }: { params: { slug: string } }) {
132133
<AvatarRow members={postDetails.authorsResolved || []} />
133134
<span className={styles.middle}>
134135
<span className={styles.authorsName}>
135-
{(postDetails.authorsResolved || []).map(member => member.name).join("; ")}
136+
{postDetails.authorsResolved && postDetails.authorsResolved.length > 4
137+
? `${postDetails.authorsResolved[0].name || "?"} et al.`
138+
: (postDetails.authorsResolved || []).map(member => member.name).join("; ")}
136139
</span>
137140
<span>
138141
{TimeUtil.formatDateInRelationToCurrent(new Date(postDetails.datetime))}{postDetails.readingTime} min luku
139142
</span>
140143
</span>
141-
<div className={styles.editButton}>
144+
<div className={styles.editButton + " print-hide"}>
142145
<EditButton small slug={postDetails.slug} />
143146
</div>
144147
</div>
@@ -175,12 +178,14 @@ export default async function Page({ params }: { params: { slug: string } }) {
175178
<Separator>Loppu</Separator>
176179
</div>
177180

178-
<Link href="/syslog">
179-
<CapsuleButton style={{marginRight: ".75em", marginTop: ".75em"}}>
180-
Kaikki postaukset
181-
</CapsuleButton>
182-
</Link>
183-
<EditButton slug={postDetails.slug} />
181+
<div className="print-hide">
182+
<Link href="/syslog">
183+
<CapsuleButton style={{marginRight: ".75em", marginTop: ".75em"}}>
184+
Kaikki postaukset
185+
</CapsuleButton>
186+
</Link>
187+
<EditButton slug={postDetails.slug} />
188+
</div>
184189
{/*
185190
<div style={{marginTop: "2rem"}}>
186191
<Breadcrumbs
@@ -192,11 +197,13 @@ export default async function Page({ params }: { params: { slug: string } }) {
192197
</div>
193198
*/}
194199
</Content>
195-
<Content wider>
196-
<div style={{marginTop: "3.5rem"}}>
197-
<PostsGrid posts={recentPosts}/>
198-
</div>
199-
</Content>
200+
<div className='print-hide'>
201+
<Content wider>
202+
<div style={{marginTop: "3.5rem"}}>
203+
<PostsGrid posts={recentPosts}/>
204+
</div>
205+
</Content>
206+
</div>
200207
<Footer />
201208
</FadeBackground>
202209
);

app/syslog/[slug]/style.module.scss

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
height: 350px;
99
border-radius: 0.5rem;
1010
margin: 1rem 0;
11+
@media print {
12+
margin: -1rem 0 1rem 0
13+
}
1114
img {
1215
object-fit:cover;
1316
border-radius: 0.5rem;
@@ -31,12 +34,18 @@
3134
display: flex;
3235
flex-direction: column;
3336
font-size: .9em;
34-
color: rgba(255,255,255,.5);
37+
3538
display: flex;
3639
gap: 4px;
40+
span {
41+
opacity: 0.6;
42+
@media print {
43+
opacity:1;
44+
}
45+
}
3746
.authorsName {
3847
font-weight: bold;
39-
color: rgba(255,255,255,.8);
48+
opacity: 1;
4049
}
4150
}
4251
.middle { flex: 1; }

components/FadeBackground/FadeBackground.module.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,13 @@
2828
background: linear-gradient(180deg, rgba(13, 13, 13, 0) 0%, rgba(0,0,0,0.7) 40.67%, #0D0D0D 96.87%);
2929
backdrop-filter: blur(5px);
3030
top: 0px;
31-
}
31+
}
32+
33+
@media print {
34+
.fadeBackground:before {
35+
display: none;
36+
}
37+
.fadeBackground:after {
38+
display: none;
39+
}
40+
}

components/Footer/Footer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function FooterRow({ children }: PropsWithChildren) {
6262

6363
export function Footer() {
6464
return (
65-
<div className={styles.footer}>
65+
<div className={styles.footer + " print-hide"}>
6666
<Content noMargin wider>
6767
<FooterRow>
6868
<div>

components/Header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function Header({ pages, authenticated = {} }: HeaderProps) {
6464
const experimentEnabled = useMesiExperiment()
6565
console.log(process.env.LOGIN_URL)
6666
return (
67-
<div className={`${styles.header} ${open ? styles.open : ""}`}>
67+
<div className={`${styles.header} ${open ? styles.open : ""} print-hide`}>
6868
<Logo className={styles.logo} link />
6969
<Navigation className={styles.navigation} pages={pages} open={open} setOpen={setOpen} />
7070
<div className={styles.navButtons}>

components/NavigateLink/NavigateLink.module.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.navigatelink {
2-
color: white;
32
font-family: 'Poppins';
4-
color: rgba(255,255,255, 0.9);
3+
opacity: 0.9;
54
display: block;
65
margin-bottom: 1em;
76
}

components/Navigation/Navigation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function Navigation({ className, pages, open, setOpen }: NavigationProps)
4646

4747
const openClassName = open ? styles.open : ""
4848
return (
49-
<div className={className ? `${className} ${openClassName}` : openClassName}>
49+
<div className={openClassName + ' ' + className}>
5050

5151
<div className={styles.mobileHeader}>
5252
{open ?

components/Separator/Separator.module.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,15 @@
1818

1919
.separator:not(:empty)::after {
2020
margin-left: 1em;
21-
}
21+
}
22+
23+
@media print {
24+
.separator {
25+
color: #000;
26+
}
27+
28+
.separator::before,
29+
.separator::after {
30+
border-bottom: 1px solid #000;
31+
}
32+
}

next.config.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import withPlaiceholder from "@plaiceholder/next";
77
const config = {
88
reactStrictMode: true,
99
images: {
10-
domains: ['localhost', 'api.testausserveri.fi', 'avatars.githubusercontent.com', 'testausauto.fi'],
10+
domains: ['localhost', 'api.testausserveri.fi', 'avatars.githubusercontent.com', 'testausauto.fi', 'cdn.discordapp.com'],
1111
},
1212
async rewrites() {
1313
return [
@@ -25,7 +25,27 @@ const config = {
2525
styledComponents: true
2626
},
2727
async redirects() {
28+
// syslog slug changes april 2025
29+
const syslogSlugChanges = {
30+
"stipendit-2023": "2023-stipendit",
31+
"disobey-collab-2025": "2025-disobey-collab",
32+
"ngh-challenge-2025": "2025-ngh-challenge",
33+
"team-finland-2024": "2024-team-finland",
34+
"testausmokki-2024": "2024-testausmokki",
35+
"testausserveri-disobey-2025": "2025-testausserveri-disobey",
36+
"testitapahtuma-1": "2025-testitapahtuma",
37+
"vectorama-ctf": "2025-vectorama-ctf"
38+
};
39+
40+
const syslogSlugChangesRules = Object.entries(syslogSlugChanges).map(([oldSlug, newSlug]) => ({
41+
source: `/syslog/${oldSlug}`,
42+
destination: `/syslog/${newSlug}`,
43+
permanent: true
44+
}));
45+
46+
// all rules
2847
return [
48+
...syslogSlugChangesRules,
2949
{ "source": "/.well-known/webfinger", "destination": "https://mastodon.testausserveri.fi/.well-known/webfinger", permanent: true },
3050
{ "source": "/github", "destination": "https://api.testausserveri.fi/v1/github/authorize", permanent: true },
3151
{ "source": "/jasenhakemus", "destination": "/apply", permanent: false },

0 commit comments

Comments
 (0)