@@ -38,6 +38,42 @@ export const query = graphql`
38
38
}
39
39
`
40
40
41
+ // the link is determined by the filename on upload oops so be careful!
42
+ const specialIssuuLinks = {
43
+ 2018 : {
44
+ spring : 'https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=finalpdf' ,
45
+ } ,
46
+ 2020 : {
47
+ winter : 'https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=master' ,
48
+ } ,
49
+ 2021 : {
50
+ winter : 'https://e.issuu.com/embed.html?d=prime_winter_21&u=dailybruin' ,
51
+ spring : 'https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=prime_w21' ,
52
+ } ,
53
+ 2022 : {
54
+ fall : 'https://e.issuu.com/embed.html?d=prime_f22_full_mag_&u=dailybruin' ,
55
+ } ,
56
+ 2023 : {
57
+ winter :
58
+ 'https://e.issuu.com/embed.html?d=prime_w23_full_mag_pages&u=dailybruin' ,
59
+ spring :
60
+ 'https://e.issuu.com/embed.html?d=prime_s23_full_mag_pages&u=dailybruin' ,
61
+ } ,
62
+ }
63
+
64
+ const getIssuuComponent = ( year : number , season : string ) => {
65
+ if ( season === 'summer' ) return null // summer issues are not magazines
66
+
67
+ if ( specialIssuuLinks [ year ] && specialIssuuLinks [ year ] [ season ] ) {
68
+ return < Magazine link = { specialIssuuLinks [ year ] [ season ] } />
69
+ }
70
+
71
+ let defaultIssuuLink = `https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=prime${ season } ${ year } `
72
+ if ( year > 2017 || ( year === 2017 && season === 'fall' ) )
73
+ defaultIssuuLink = `https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=prime_${ season } _${ year } `
74
+ return < Magazine link = { defaultIssuuLink } />
75
+ }
76
+
41
77
export default ( { data, pageContext } ) => {
42
78
let articles = [ ]
43
79
data . allPrimeArticle . edges . forEach ( edge => {
@@ -55,19 +91,6 @@ export default ({ data, pageContext }) => {
55
91
const term = pageContext . term
56
92
const season = term . substring ( 0 , term . length - 2 )
57
93
const year = '20' + term . substring ( term . length - 2 , term . length )
58
- let issuuLink = `https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=prime${ season } ${ year } `
59
- if ( parseInt ( year ) > 2017 || ( parseInt ( year ) === 2017 && season === 'fall' ) )
60
- issuuLink = `https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=prime_${ season } _${ year } `
61
- if ( term === 'spring18' )
62
- issuuLink =
63
- 'https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=finalpdf'
64
- if ( term == 'winter20' )
65
- issuuLink = 'https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=master'
66
- if ( term == 'winter21' )
67
- issuuLink = `https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=prime_w21`
68
- if ( term == 'spring21' )
69
- issuuLink = `https://e.issuu.com/anonymous-embed.html?u=dailybruin&d=prime_spring_21`
70
- // the link is determined by the filename on upload oops so be careful!
71
94
const formatTerm = season + ' ' + year
72
95
const articleCards = [ ]
73
96
articles . forEach ( ( article , i ) => {
@@ -150,9 +173,7 @@ export default ({ data, pageContext }) => {
150
173
>
151
174
< ArticleGrid > { articleCards } </ ArticleGrid >
152
175
</ div >
153
- { term != 'summer20' && term != 'summer21' && (
154
- < Magazine link = { issuuLink } />
155
- ) }
176
+ { getIssuuComponent ( parseInt ( year ) , season ) }
156
177
< Footer />
157
178
</ div >
158
179
</ div >
0 commit comments