Skip to content

Commit d096f37

Browse files
Merge pull request #5908 from webkom/readme-revamp
README REVAMP
2 parents 1780f96 + 8964ef3 commit d096f37

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

lego-webapp/pages/bdb/company-interest/CompanyInterestForm.module.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,28 @@
6262
.label {
6363
color: var(--danger-color);
6464
}
65+
66+
.readMe :global([class*='heading']) {
67+
font-size: var(--font-size-lg);
68+
}
69+
70+
.readMe :global([class*='thumbnailContainer']) {
71+
padding-top: 0px;
72+
margin: 0px;
73+
display: grid;
74+
grid-template-columns: repeat(2, 1fr);
75+
grid-template-rows: repeat(2, min-content);
76+
gap: var(--spacing-xs);
77+
overflow: hidden;
78+
79+
@media (--mobile-device) {
80+
gap: var(--spacing-xs);
81+
}
82+
83+
@media (--small-viewport) {
84+
gap: var(--spacing-xs);
85+
}
86+
}
87+
.readMe {
88+
padding-top: 25px;
89+
}

lego-webapp/pages/bdb/company-interest/CompanyInterestForm.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import SubmissionError from '~/components/Form/SubmissionError';
2222
import { SubmitButton } from '~/components/Form/SubmitButton';
2323
import ToggleSwitch from '~/components/Form/ToggleSwitch';
2424
import { readmeIfy } from '~/components/ReadmeLogo';
25+
import LatestReadme from '~/pages/index/LatestReadme';
2526
import {
2627
fetchSemesters,
2728
fetchSemestersForInterestform,
@@ -31,6 +32,7 @@ import {
3132
fetchCompanyInterest,
3233
updateCompanyInterest,
3334
} from '~/redux/actions/CompanyInterestActions';
35+
import { fetchReadmes } from '~/redux/actions/FrontpageActions';
3436
import { useAppDispatch, useAppSelector } from '~/redux/hooks';
3537
import { selectCompanyInterestById } from '~/redux/slices/companyInterest';
3638
import {
@@ -52,6 +54,7 @@ import {
5254
COMPANY_TYPES,
5355
EVENTS,
5456
FORM_LABELS,
57+
OTHER_DESCRIPTIONS,
5558
OTHER_OFFERS,
5659
SURVEY_OFFERS,
5760
TARGET_GRADES,
@@ -69,8 +72,10 @@ import {
6972
sortSemesterChronologically,
7073
surveyOffersToString,
7174
targetGradeToString,
75+
othersDescriptionToString,
7276
} from './utils';
7377
import type { ReactNode } from 'react';
78+
7479
import type { DetailedCompanyInterest } from '~/redux/models/CompanyInterest';
7580
import type CompanySemester from '~/redux/models/CompanySemester';
7681

@@ -184,11 +189,20 @@ const OtherBox = ({
184189
label={readmeIfy(OTHER_OFFERS[otherOffersToString(key)][language])}
185190
type="checkbox"
186191
component={CheckBox.Field}
192+
description={
193+
OTHER_DESCRIPTIONS[othersDescriptionToString(key)][language]
194+
}
187195
/>
188196
))}
189197
</Flex>
190198
);
191199

200+
const readMe = (
201+
<Flex className={styles.readMe}>
202+
<LatestReadme expandedInitially={true} />
203+
</Flex>
204+
);
205+
192206
const CollaborationBox = ({
193207
fields,
194208
language,
@@ -339,6 +353,10 @@ const CompanyInterestForm = ({ language }: Props) => {
339353
[companyInterestId, edit],
340354
);
341355

356+
usePreparedEffect('fetchReadmes', () => dispatch(fetchReadmes(2)), [
357+
dispatch,
358+
]);
359+
342360
const allEvents = Object.keys(EVENTS);
343361
const allOtherOffers = Object.keys(OTHER_OFFERS);
344362
const allCollaborations = Object.keys(COLLABORATION_TYPES);
@@ -742,6 +760,7 @@ const CompanyInterestForm = ({ language }: Props) => {
742760
component={OtherBox}
743761
/>
744762
</MultiSelectGroup>
763+
{readMe}
745764
</Flex>
746765
</Flex>
747766
<div className={styles.topline} />

lego-webapp/pages/bdb/company-interest/Translations.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,19 @@ export const COLLABORATION_DESCRIPTIONS = {
205205
},
206206
};
207207

208+
export const OTHER_DESCRIPTIONS = {
209+
ad_readme: {
210+
norwegian:
211+
'readme er Gløshaugens største linjeforeningsmagasin, som kommer ut tre ganger i semesteret, og vi har et opplag på 500 eksemplarer hver utgave. Magasinet er gratis, distribueres på hele NTNUs campus Gløshaugen, og når ut til over 900 studenter innenfor datateknologi, cybersikkerhet, datakommunikasjon og informasjonsteknologi.',
212+
english:
213+
'readme is the largest student association magazine at Gløshaugen. It is published three times per semester, with a print run of 500 copies per issue. The magazine is free, distributed across NTNU’s Gløshaugen campus, and reaches more than 900 students in computer science, cyber security, data communications, and information technology',
214+
},
215+
prof_social_media: {
216+
norwegian: '',
217+
english: '',
218+
},
219+
};
220+
208221
export const TARGET_GRADES = {
209222
'1': {
210223
norwegian: '1. klasse',

lego-webapp/pages/bdb/company-interest/utils.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
OTHER_OFFERS,
99
TARGET_GRADES,
1010
COLLABORATION_DESCRIPTIONS,
11+
OTHER_DESCRIPTIONS,
1112
} from './Translations';
1213
import type CompanySemester from '~/redux/models/CompanySemester';
1314

@@ -86,6 +87,9 @@ export const otherOffersToString = (offer) =>
8687
export const collaborationToString = (collab) =>
8788
Object.keys(COLLABORATION_TYPES)[Number(collab.charAt(collab.length - 2))];
8889

90+
export const othersDescriptionToString = (others) =>
91+
Object.keys(OTHER_DESCRIPTIONS)[Number(others.charAt(others.length - 2))];
92+
8993
export const targetGradeToString = (targetGrade) =>
9094
Object.keys(TARGET_GRADES)[
9195
Number(targetGrade.charAt(targetGrade.length - 2))

lego-webapp/pages/index/LatestReadme.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const LatestReadme = ({
2020
displayCount = 4,
2121
}: Props) => {
2222
const readmes = useAppSelector((state) => state.readme);
23-
2423
return (
2524
<Card className={styles.latestReadme} style={style}>
2625
<Accordion

0 commit comments

Comments
 (0)