profile
viewpoint

Andorr/AR_Playground 5

Simple playground using Unity and Vuforia's AR possibilities

Andorr/SettlersOfCatlan 4

A multiplayer strategy game based on Settlers Of Catan made in Unity

halvorboe/httimple-rs 2

Simple HTTP 2.0 library for building APIs

halvorboe/JPhysics 1

Simple physics engine with collision and springs.

halvorboe/rustflix 1

Websocket server for streaming video

halvorboe/3tactoe 0

Attempt at making bot for multi board no tac toe

halvorboe/AlienAdventure 0

Gamemade at hackaton

halvorboe/CogQL 0

GraphQL API wrapper for Cognite API

issue openedlucid-kv/lucid

[docs] DNS NXDomain

When attempting to goto the docs i get an NXDomain result from chrome.

created time in 5 hours

issue commenttihlde/Kvark

Lage Wiki

Flere tanker rundt løsning ligger på Slab: https://tihlde.slab.com/posts/wiki-rabx42r7

Zenjjim

comment created time in 7 hours

push eventtihlde/Kvark

olros

commit sha 18e6d7b8b815032d97b2fbc5f5d7fa5af24d983c

Update EventEditor.tsx

view details

push time in 9 hours

issue commenttihlde/Kvark

Fiks tekststørrelse på banner på små mobiler

Fiks ved å sette font-size: 40px ved [theme.breakpoints.down('sm)]

olros

comment created time in 14 hours

pull request commenttihlde/Kvark

Refactor/typescript multiple

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/tihlde/kvark/imazwac4l
✅ Preview: https://kvark-git-refactor-typescript-multiple.tihlde.vercel.app

olros

comment created time in 14 hours

PR opened tihlde/Kvark

Reviewers
Refactor/typescript multiple enhancement refactor

Description

Comments/issues/screenshots:

  • Refactored SignUp and ForgotPassword to Typescript with React-Hook-Form
    • Errors from Lepton for field-errors is applied to the correct field
  • Added the new Textfield to EventEditor and added some typings for useForm
  • Refactored Fetch.tsx which now trows on error instead of custom object which has to be checked for isError later. Eases implementation and saves a lot of duplicate code
  • No visual changes

#243 #197

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [x] The PR includes a closes #issueID
  • [ ] The PR includes a picture showing visual changes

Typescript convert checklist

  • [x] All relative imports has been converted to absolute imports
  • [x] All HOC's have been replaced with Hooks
  • [x] Uses theme.spacing() instead of custom padding
  • [x] Uses theme.breakpoints instead of custom media queries
+725 -1056

0 comment

26 changed files

pr created time in 14 hours

push eventtihlde/Kvark

olros

commit sha 76f835df8cfacb089afc5877e2be97f3cb9e9275

refactor(auth): forgot password to typescript

view details

push time in 14 hours

create barnchtihlde/Kvark

branch : refactor/typescript-multiple

created branch time in 14 hours

PR opened tihlde/Lepton

Update exceptions.py

Proposed changes

Sentry is logging both error in code, but also error in query. This PR will remove the query logg

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • [ ] Pull request title follows conventional commits (type(scope): description)
  • [ ] Build (make PR) was run locally without failures

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

+0 -3

0 comment

1 changed file

pr created time in 18 hours

create barnchtihlde/Lepton

branch : fix/double_logging_sentry

created branch time in 18 hours

CommitCommentEvent

push eventtihlde/Kvark

Olaf Rosendahl

commit sha c989677efe5cd7416bc5d7b1f65018c0e9cda2f9

refactor(typescript): login and companies (#343) * refactor(ts): change file endings * refactor(ts): change file ending * refactor(login): use typescript and react hook form * refactor(ts): change file endings * refactor(companies): to typescript and create container component * refactor(companies): recreate form * fix(fields:) empty textfields on submit * fix * refactor(input): create textfield component * Add type * Remove duplicate header

view details

push time in 19 hours

delete branch tihlde/Kvark

delete branch : refactor/typescript-multiple

delete time in 19 hours

PR merged tihlde/Kvark

Reviewers
refactor(typescript): login and companies refactor

Description

Comments/issues/screenshots:

  • Made URLS and settings (renames to constant) tsx-files
  • Created a container-component which provides the Material-UI container with default props
  • Refactor Login and Companies-pages to typescript and move their text from separate files into the component
  • Stops users trying to login with email by giving a warning
  • Used React-Hook-Form in all forms
  • No big visual changes

closes #321 #243 #197

Pull request checklist

Please check if your PR fulfills the following requirements:

  • [x] The PR includes a closes #issueID
  • [ ] The PR includes a picture showing visual changes

Typescript convert checklist

  • [x] All relative imports has been converted to absolute imports
  • [x] All HOC's have been replaced with Hooks
  • [x] Uses theme.spacing() instead of custom padding
  • [x] Uses theme.breakpoints instead of custom media queries
+481 -764

1 comment

21 changed files

olros

pr closed time in 19 hours

issue closedtihlde/Kvark

Sjekk at !epost ved innlogging

Brukerstory: Som bruker vet jeg ikke om jeg skal logge inn med epost eller brukernavn. Hadde vært fint med tilbakemelding på at man skal bruke brukernavn hvis jeg prøver med epost.

Lett å fikse med en .includes('@') sjekk på brukernavn.

closed time in 19 hours

olros

push eventtihlde/Kvark

olros

commit sha 1531629a23b747e537169ed51628b2e6f8f482d3

Remove duplicate header

view details

push time in 19 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useState } from 'react';+import { useForm } from 'react-hook-form';+import { Link, useNavigate } from 'react-router-dom';+import Helmet from 'react-helmet';+import URLS from 'URLS';+import { useAuth } from 'api/hooks/Auth';+import { useMisc } from 'api/hooks/Misc';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import Button from '@material-ui/core/Button';+import LinearProgress from '@material-ui/core/LinearProgress';++// Project Components+import Navigation from 'components/navigation/Navigation';+import Paper from 'components/layout/Paper';+import TihldeLogo from 'components/miscellaneous/TihldeLogo';+import TextField from 'components/inputs/TextField';++const useStyles = makeStyles((theme) => ({+  top: {+    height: 220,+    background: `radial-gradient(circle at bottom, ${theme.palette.colors.gradient.secondary.top}, ${theme.palette.colors.gradient.secondary.bottom})`,+  },+  paper: {+    maxWidth: theme.breakpoints.values.sm,+    margin: 'auto',+    position: 'relative',+    left: 0,+    right: 0,+    top: -60,+  },+  logo: {+    height: 30,+    width: 'auto',+    marginBottom: theme.spacing(1),+  },+  progress: {+    position: 'absolute',+    top: 0,+    left: 0,+    right: 0,+  },+  buttons: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    gridGap: theme.spacing(1),+  },+  button: {+    marginTop: theme.spacing(2),+  },+}));++type LoginData = {+  username: string;+  password: string;+};++const LogIn = () => {+  const classes = useStyles();+  const navigate = useNavigate();+  const { logIn } = useAuth();+  const { setLogInRedirectURL, getLogInRedirectURL } = useMisc();+  const { register, errors, handleSubmit, setError } = useForm();+  const [isLoading, setIsLoading] = useState(false);++  const onLogin = async (data: LoginData) => {+    if (isLoading) {+      return;+    }+    setIsLoading(true);+    try {+      await logIn(data.username, data.password);+      const redirectURL = getLogInRedirectURL();+      setLogInRedirectURL(null);+      navigate(redirectURL || URLS.landing);+    } catch (e) {+      setError('password', { message: e.detail || 'Noe gikk galt' });+      setIsLoading(false);+    }+  };++  return (+    <Navigation banner={<div className={classes.top} />} fancyNavbar>+      <Helmet>+        <title>Logg inn - TIHLDE</title>+      </Helmet>+      <Paper className={classes.paper}>+        {isLoading && <LinearProgress className={classes.progress} />}+        <TihldeLogo className={classes.logo} darkColor='white' lightColor='blue' size='large' />+        <Typography variant='h3'>Logg inn</Typography>+        <form onSubmit={handleSubmit(onLogin)}>+          <TextField+            errors={errors}+            label='Brukernavn'+            name='username'+            register={register}+            required+            rules={{+              required: 'Feltet er påkrevd',+              validate: (value: string) => (value.includes('@') ? 'Bruk feide brukernavn, ikke epost' : undefined),+            }}+          />+          <TextField errors={errors} label='Passord' name='password' register={register} required rules={{ required: 'Feltet er påkrevd' }} type='password' />

Ta endring av linting i en annen pr

olros

comment created time in 19 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useState } from 'react';+import { useForm } from 'react-hook-form';+import { Link, useNavigate } from 'react-router-dom';+import Helmet from 'react-helmet';+import URLS from 'URLS';+import { useAuth } from 'api/hooks/Auth';+import { useMisc } from 'api/hooks/Misc';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import Button from '@material-ui/core/Button';+import LinearProgress from '@material-ui/core/LinearProgress';++// Project Components+import Navigation from 'components/navigation/Navigation';+import Paper from 'components/layout/Paper';+import TihldeLogo from 'components/miscellaneous/TihldeLogo';+import TextField from 'components/inputs/TextField';++const useStyles = makeStyles((theme) => ({+  top: {+    height: 220,+    background: `radial-gradient(circle at bottom, ${theme.palette.colors.gradient.secondary.top}, ${theme.palette.colors.gradient.secondary.bottom})`,+  },+  paper: {+    maxWidth: theme.breakpoints.values.sm,+    margin: 'auto',+    position: 'relative',+    left: 0,+    right: 0,+    top: -60,+  },+  logo: {+    height: 30,+    width: 'auto',+    marginBottom: theme.spacing(1),+  },+  progress: {+    position: 'absolute',+    top: 0,+    left: 0,+    right: 0,+  },+  buttons: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    gridGap: theme.spacing(1),+  },+  button: {+    marginTop: theme.spacing(2),+  },+}));++type LoginData = {+  username: string;+  password: string;+};++const LogIn = () => {+  const classes = useStyles();+  const navigate = useNavigate();+  const { logIn } = useAuth();+  const { setLogInRedirectURL, getLogInRedirectURL } = useMisc();+  const { register, errors, handleSubmit, setError } = useForm();+  const [isLoading, setIsLoading] = useState(false);++  const onLogin = async (data: LoginData) => {+    if (isLoading) {+      return;+    }+    setIsLoading(true);+    try {+      await logIn(data.username, data.password);+      const redirectURL = getLogInRedirectURL();+      setLogInRedirectURL(null);+      navigate(redirectURL || URLS.landing);+    } catch (e) {+      setError('password', { message: e.detail || 'Noe gikk galt' });+      setIsLoading(false);+    }+  };++  return (+    <Navigation banner={<div className={classes.top} />} fancyNavbar>+      <Helmet>+        <title>Logg inn - TIHLDE</title>+      </Helmet>+      <Paper className={classes.paper}>+        {isLoading && <LinearProgress className={classes.progress} />}+        <TihldeLogo className={classes.logo} darkColor='white' lightColor='blue' size='large' />+        <Typography variant='h3'>Logg inn</Typography>+        <form onSubmit={handleSubmit(onLogin)}>+          <TextField+            errors={errors}+            label='Brukernavn'+            name='username'+            register={register}+            required+            rules={{+              required: 'Feltet er påkrevd',+              validate: (value: string) => (value.includes('@') ? 'Bruk feide brukernavn, ikke epost' : undefined),+            }}+          />+          <TextField errors={errors} label='Passord' name='password' register={register} required rules={{ required: 'Feltet er påkrevd' }} type='password' />

Formater dette på flere linjer er du snill

olros

comment created time in 19 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { forwardRef, Ref } from 'react';+import classnames from 'classnames';++// Material UI Components

https://github.com/benmosher/eslint-plugin-import

olros

comment created time in 20 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { forwardRef, Ref } from 'react';+import classnames from 'classnames';++// Material UI Components

https://eslint.org/docs/rules/sort-imports

olros

comment created time in 20 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useMemo, useState } from 'react';+import { useForm } from 'react-hook-form';+import { CompaniesEmail } from 'types/Types';+import { useMisc } from 'api/hooks/Misc';+import useSnackbar from 'api/hooks/Snackbar';+import addMonths from 'date-fns/addMonths';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import TextField from '@material-ui/core/TextField';+import Divider from '@material-ui/core/Divider';+import Checkbox from '@material-ui/core/Checkbox';+import Button from '@material-ui/core/Button';+import FormLabel from '@material-ui/core/FormLabel';+import FormControl from '@material-ui/core/FormControl';+import FormGroup from '@material-ui/core/FormGroup';+import FormControlLabel from '@material-ui/core/FormControlLabel';++// Project components+import Paper from 'components/layout/Paper';++const useStyles = makeStyles((theme) => ({+  content: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    gridGap: theme.spacing(2),+    padding: theme.spacing(1, 2),+    [theme.breakpoints.down('sm')]: {+      gridTemplateColumns: '1fr',+      padding: theme.spacing(1),+      gridGap: theme.spacing(1),+    },+  },+  label: {+    color: theme.palette.text.primary,+  },+}));++const CompaniesForm = () => {+  const classes = useStyles();+  const showSnackbar = useSnackbar();+  const { postEmail } = useMisc();+  const [isLoading, setIsLoading] = useState(false);+  const { register, handleSubmit, errors, reset, setError } = useForm();++  const submitForm = async (data: CompaniesEmail) => {+    if (isLoading) {+      return;+    }+    setIsLoading(true);+    try {+      const response = await postEmail(data);+      showSnackbar(response.detail, 'success');+      reset({ info: { bedrift: '', kontaktperson: '', epost: '' }, comment: '' });+    } catch (e) {+      setError('bedrift', { type: 'manual', message: e.detail || 'Noe gikk galt' });+    } finally {+      setIsLoading(false);+    }+  };++  const getSemester = (semester: number) => {

Ååååå skjønner skjønner

olros

comment created time in 20 hours

push eventtihlde/Kvark

olros

commit sha 03aa901f9879bcb00d82fcb9b8014a90d0fcd588

refactor(input): create textfield component

view details

olros

commit sha 80f58b0cfd8610bdf0ea6ca6f0f5fa3869db6c25

Add type

view details

push time in 21 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useState } from 'react';+import { useForm } from 'react-hook-form';+import { Link, useNavigate } from 'react-router-dom';+import Helmet from 'react-helmet';+import URLS from 'URLS';+import { useAuth } from 'api/hooks/Auth';+import { useMisc } from 'api/hooks/Misc';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import TextField from '@material-ui/core/TextField';+import Grid from '@material-ui/core/Grid';+import Button from '@material-ui/core/Button';+import LinearProgress from '@material-ui/core/LinearProgress';++// Project Components+import Navigation from 'components/navigation/Navigation';+import Paper from 'components/layout/Paper';+import TihldeLogo from 'components/miscellaneous/TihldeLogo';++const useStyles = makeStyles((theme) => ({+  top: {+    height: 220,+    background:+      'radial-gradient(circle at bottom, ' + theme.palette.colors.gradient.secondary.top + ', ' + theme.palette.colors.gradient.secondary.bottom + ')',+  },+  paper: {+    maxWidth: theme.breakpoints.values.sm,+    margin: 'auto',+    position: 'relative',+    left: 0,+    right: 0,+    top: -60,

For å flytte login-boksen litt opp over over top-gradienten

image

olros

comment created time in 21 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { forwardRef, Ref } from 'react';+import classnames from 'classnames';++// Material UI Components

Hat du en eslint/prettier pakke som sorterer imports @Zenjjim ? Er veldig med på det

olros

comment created time in 21 hours

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useMemo, useState } from 'react';+import { useForm } from 'react-hook-form';+import { CompaniesEmail } from 'types/Types';+import { useMisc } from 'api/hooks/Misc';+import useSnackbar from 'api/hooks/Snackbar';+import addMonths from 'date-fns/addMonths';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import TextField from '@material-ui/core/TextField';+import Divider from '@material-ui/core/Divider';+import Checkbox from '@material-ui/core/Checkbox';+import Button from '@material-ui/core/Button';+import FormLabel from '@material-ui/core/FormLabel';+import FormControl from '@material-ui/core/FormControl';+import FormGroup from '@material-ui/core/FormGroup';+import FormControlLabel from '@material-ui/core/FormControlLabel';++// Project components+import Paper from 'components/layout/Paper';++const useStyles = makeStyles((theme) => ({+  content: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    gridGap: theme.spacing(2),+    padding: theme.spacing(1, 2),+    [theme.breakpoints.down('sm')]: {+      gridTemplateColumns: '1fr',+      padding: theme.spacing(1),+      gridGap: theme.spacing(1),+    },+  },+  label: {+    color: theme.palette.text.primary,+  },+}));++const CompaniesForm = () => {+  const classes = useStyles();+  const showSnackbar = useSnackbar();+  const { postEmail } = useMisc();+  const [isLoading, setIsLoading] = useState(false);+  const { register, handleSubmit, errors, reset, setError } = useForm();++  const submitForm = async (data: CompaniesEmail) => {+    if (isLoading) {+      return;+    }+    setIsLoading(true);+    try {+      const response = await postEmail(data);+      showSnackbar(response.detail, 'success');+      reset({ info: { bedrift: '', kontaktperson: '', epost: '' }, comment: '' });+    } catch (e) {+      setError('bedrift', { type: 'manual', message: e.detail || 'Noe gikk galt' });+    } finally {+      setIsLoading(false);+    }+  };++  const getSemester = (semester: number) => {

Hvordan skal det funke? Til sommeren er jo semester[0] høsten og da partall?

olros

comment created time in a day

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useState } from 'react';+import { useForm } from 'react-hook-form';+import { Link, useNavigate } from 'react-router-dom';+import Helmet from 'react-helmet';+import URLS from 'URLS';+import { useAuth } from 'api/hooks/Auth';+import { useMisc } from 'api/hooks/Misc';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import TextField from '@material-ui/core/TextField';+import Grid from '@material-ui/core/Grid';+import Button from '@material-ui/core/Button';+import LinearProgress from '@material-ui/core/LinearProgress';++// Project Components+import Navigation from 'components/navigation/Navigation';+import Paper from 'components/layout/Paper';+import TihldeLogo from 'components/miscellaneous/TihldeLogo';++const useStyles = makeStyles((theme) => ({+  top: {+    height: 220,+    background:+      'radial-gradient(circle at bottom, ' + theme.palette.colors.gradient.secondary.top + ', ' + theme.palette.colors.gradient.secondary.bottom + ')',+  },+  paper: {+    maxWidth: theme.breakpoints.values.sm,+    margin: 'auto',+    position: 'relative',+    left: 0,+    right: 0,+    top: -60,+  },+  logo: {+    height: 30,+    width: 'auto',+    marginBottom: theme.spacing(1),+  },+  progress: {+    position: 'absolute',+    top: 0,+    left: 0,+    right: 0,+  },+  buttons: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    gridGap: theme.spacing(1),+  },+  button: {+    marginTop: theme.spacing(2),+  },+}));++type LoginData = {+  username: string;+  password: string;+};++const LogIn = () => {+  const classes = useStyles();+  const navigate = useNavigate();+  const { logIn } = useAuth();+  const { setLogInRedirectURL, getLogInRedirectURL } = useMisc();+  const { register, errors, handleSubmit, setError } = useForm();+  const [isLoading, setIsLoading] = useState(false);++  const onLogin = async (data: LoginData) => {+    if (isLoading) {+      return;+    }+    if (data.username.includes('@')) {+      setError('username', { type: 'manual', message: 'Bruk brukernavnet på NTNU, ikke en epost-adresse' });

Det gjøres ved å bruke enten pattern eller validate i RHF

olros

comment created time in a day

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useState } from 'react';+import { useForm } from 'react-hook-form';+import { Link, useNavigate } from 'react-router-dom';+import Helmet from 'react-helmet';+import URLS from 'URLS';+import { useAuth } from 'api/hooks/Auth';+import { useMisc } from 'api/hooks/Misc';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import TextField from '@material-ui/core/TextField';+import Grid from '@material-ui/core/Grid';+import Button from '@material-ui/core/Button';+import LinearProgress from '@material-ui/core/LinearProgress';++// Project Components+import Navigation from 'components/navigation/Navigation';+import Paper from 'components/layout/Paper';+import TihldeLogo from 'components/miscellaneous/TihldeLogo';++const useStyles = makeStyles((theme) => ({+  top: {+    height: 220,+    background:+      'radial-gradient(circle at bottom, ' + theme.palette.colors.gradient.secondary.top + ', ' + theme.palette.colors.gradient.secondary.bottom + ')',+  },+  paper: {+    maxWidth: theme.breakpoints.values.sm,+    margin: 'auto',+    position: 'relative',+    left: 0,+    right: 0,+    top: -60,

Ser ikke helt ut som bra css

olros

comment created time in a day

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useState } from 'react';+import { useForm } from 'react-hook-form';+import { Link, useNavigate } from 'react-router-dom';+import Helmet from 'react-helmet';+import URLS from 'URLS';+import { useAuth } from 'api/hooks/Auth';+import { useMisc } from 'api/hooks/Misc';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import TextField from '@material-ui/core/TextField';+import Grid from '@material-ui/core/Grid';+import Button from '@material-ui/core/Button';+import LinearProgress from '@material-ui/core/LinearProgress';++// Project Components+import Navigation from 'components/navigation/Navigation';+import Paper from 'components/layout/Paper';+import TihldeLogo from 'components/miscellaneous/TihldeLogo';++const useStyles = makeStyles((theme) => ({+  top: {+    height: 220,+    background:+      'radial-gradient(circle at bottom, ' + theme.palette.colors.gradient.secondary.top + ', ' + theme.palette.colors.gradient.secondary.bottom + ')',+  },+  paper: {+    maxWidth: theme.breakpoints.values.sm,+    margin: 'auto',+    position: 'relative',+    left: 0,+    right: 0,+    top: -60,+  },+  logo: {+    height: 30,+    width: 'auto',+    marginBottom: theme.spacing(1),+  },+  progress: {+    position: 'absolute',+    top: 0,+    left: 0,+    right: 0,+  },+  buttons: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    gridGap: theme.spacing(1),+  },+  button: {+    marginTop: theme.spacing(2),+  },+}));++type LoginData = {+  username: string;+  password: string;+};++const LogIn = () => {+  const classes = useStyles();+  const navigate = useNavigate();+  const { logIn } = useAuth();+  const { setLogInRedirectURL, getLogInRedirectURL } = useMisc();+  const { register, errors, handleSubmit, setError } = useForm();+  const [isLoading, setIsLoading] = useState(false);++  const onLogin = async (data: LoginData) => {+    if (isLoading) {+      return;+    }+    if (data.username.includes('@')) {+      setError('username', { type: 'manual', message: 'Bruk brukernavnet på NTNU, ikke en epost-adresse' });

Og dette burde bli gjort i react-hook-form ikke i submit funksjonen. Validering skal skje før

olros

comment created time in a day

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useState } from 'react';+import { useForm } from 'react-hook-form';+import { Link, useNavigate } from 'react-router-dom';+import Helmet from 'react-helmet';+import URLS from 'URLS';+import { useAuth } from 'api/hooks/Auth';+import { useMisc } from 'api/hooks/Misc';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import TextField from '@material-ui/core/TextField';+import Grid from '@material-ui/core/Grid';+import Button from '@material-ui/core/Button';+import LinearProgress from '@material-ui/core/LinearProgress';++// Project Components+import Navigation from 'components/navigation/Navigation';+import Paper from 'components/layout/Paper';+import TihldeLogo from 'components/miscellaneous/TihldeLogo';++const useStyles = makeStyles((theme) => ({+  top: {+    height: 220,+    background:+      'radial-gradient(circle at bottom, ' + theme.palette.colors.gradient.secondary.top + ', ' + theme.palette.colors.gradient.secondary.bottom + ')',+  },+  paper: {+    maxWidth: theme.breakpoints.values.sm,+    margin: 'auto',+    position: 'relative',+    left: 0,+    right: 0,+    top: -60,+  },+  logo: {+    height: 30,+    width: 'auto',+    marginBottom: theme.spacing(1),+  },+  progress: {+    position: 'absolute',+    top: 0,+    left: 0,+    right: 0,+  },+  buttons: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    gridGap: theme.spacing(1),+  },+  button: {+    marginTop: theme.spacing(2),+  },+}));++type LoginData = {+  username: string;+  password: string;+};++const LogIn = () => {+  const classes = useStyles();+  const navigate = useNavigate();+  const { logIn } = useAuth();+  const { setLogInRedirectURL, getLogInRedirectURL } = useMisc();+  const { register, errors, handleSubmit, setError } = useForm();+  const [isLoading, setIsLoading] = useState(false);++  const onLogin = async (data: LoginData) => {+    if (isLoading) {+      return;+    }+    if (data.username.includes('@')) {+      setError('username', { type: 'manual', message: 'Bruk brukernavnet på NTNU, ikke en epost-adresse' });+      return;+    }+    setIsLoading(true);+    try {+      await logIn(data.username, data.password);+      const redirectURL = getLogInRedirectURL();+      setLogInRedirectURL(null);+      navigate(redirectURL || URLS.landing);+    } catch (e) {+      setError('password', { type: 'manual', message: e.detail || 'Noe gikk galt' });+    }+    setIsLoading(false);+  };++  return (+    <Navigation banner={<div className={classes.top} />} fancyNavbar>+      <Helmet>+        <title>Logg inn - TIHLDE</title>+      </Helmet>+      <Paper className={classes.paper}>+        {isLoading && <LinearProgress className={classes.progress} />}+        <TihldeLogo className={classes.logo} darkColor='white' lightColor='blue' size='large' />+        <Typography variant='h3'>Logg inn</Typography>+        <form onSubmit={handleSubmit(onLogin)}>+          <Grid container direction='column'>

Haha ♥

olros

comment created time in a day

Pull request review commenttihlde/Kvark

refactor(typescript): login and companies

+import { useRef } from 'react';+import URLS from 'URLS';+import Helmet from 'react-helmet';++// Material UI Components+import { makeStyles } from '@material-ui/core/styles';+import Typography from '@material-ui/core/Typography';+import Button from '@material-ui/core/Button';++// Icons and images+import Image from 'assets/img/glad.jpg';+import SendIcon from '@material-ui/icons/SendRounded';++// Project Components+import Navigation from 'components/navigation/Navigation';+import InfoCard from 'components/layout/InfoCard';+import Banner from 'components/layout/Banner';+import CompaniesForm from 'containers/Companies/components/CompaniesForm';+import Container from 'components/layout/Container';++const useStyles = makeStyles((theme) => ({+  grid: {+    display: 'grid',+    gridTemplateColumns: '1fr 1fr',+    margin: '0 auto',+    gridGap: theme.spacing(2),+    justifyContent: 'center',+    [theme.breakpoints.down('sm')]: {+      gridGap: theme.spacing(1),+      gridTemplateColumns: '1fr',+    },+  },+  gridWide: {+    [theme.breakpoints.up('md')]: {+      gridColumn: 'span 2',+    },+  },+  section: {+    paddingTop: theme.spacing(2),+    paddingBottom: theme.spacing(4),+  },+  imageClass: {+    width: 400,+    maxWidth: 'none',+    maxHeight: 'none',+    height: 'auto',+    [theme.breakpoints.down('md')]: {+      width: '100%',+    },+  },+  smoke: {+    backgroundColor: theme.palette.background.smoke,+  },+  bannerButton: {+    width: '100%',+    color: theme.palette.common.white,+    borderColor: theme.palette.common.white + 'bb',+    minWidth: 200,+    '&:hover': {+      borderColor: theme.palette.common.white,+    },+  },+}));++const Companies = () => {+  const classes = useStyles();+  const formRef = useRef<HTMLDivElement>(null);++  const scrollToForm = () => {+    !formRef.current || window.scroll({ top: formRef.current.offsetTop - 84, left: 0, behavior: 'smooth' });+  };++  const text = {+    aboutUs: `TIHLDE (Trondheim IngeniørHøgskoles Linjeforening for Dannede EDBere) er linjeforeningen for bachelorstudiene Dataingeniør, Digital infrastruktur og cybersikkerhet, Digital forretningsutvikling, Drift av datasystemer, samt masterstudiet Digital samhandling ved AIT, IDI, NTNU på Gløshaugen.`,+    dataing: `Dataingeniør-studiet kombinerer det beste fra de spesialiserte informatikkutdanningene og de tradisjonelle ingeniørutdanningene.+Det legger mye vekt på praktisk utvikling av systemer og programmer, og studentene får et godt grunnlag i datateknikk, matematikk og teknisk-naturvitenskapelige fag, samt varig og verdifull kompetanse om hvordan datateknikk kan benyttes.`,+    drift: `Dette bachelorstudiet setter fokus på den drift-tekniske IKT-kompetansen bedrifter etterspør. Studentene lærer planleggingsprosesser og oppsett av virtuelle maskiner med bruk av teknologier som VMWare og HyperV. Videre temaer i studiet er Linux, Windows Server, “Cloud Computing” og overvåkning og sikkerhet i digital infrastruktur.`,+    digsec: `Digital samhandling er et veletablert forskningsområde som tar for seg hvordan utøvelse og koordinering av samarbeidsaktiviteter kan støttes ved hjelp av ulike IKT-systemer. Studentene ved denne 2 årige masteren er i stand til å samhandle effektivt i forskjellige tverrfaglige problemløsningsprosesser.`,+    digfor: `Digital forretningsutvikling kombinerer IT, økonomi og ledelse for å skape forretningsutviklere med tverrfaglig kompetanse. For at samfunnet skal digitaliseres er det nødvendig med ledere som har både teknisk og økonomisk kompetanse. Digital forretningsutvikling er lagt opp med høyt fokus på praktisk erfaring innenfor teamarbeid og kommunikasjon. Studiet søker å utdanne dyktige endringsagenter som kan effektivisere arbeidsprosesser og implementere digitale løsninger i bedrifter.`,+    ads: `Vi tilbyr promotering av stillingsannonser ut til våre 600 dyktige studenter på vår karriereside <a href="${URLS.jobposts}">tihlde.org/karriere</a>.`,+    course: `Et kurs er et faglig arrangement hvor fokuset skal være på å introdusere studentene for faglige erfaringer som de kan få bruk for i arbeidslivet. Kurset kan inneholde en rask presentasjon av bedriften før kurset starter. Vi legger tilrette for matservering på skolen etter kurset, eller bespisning på restaurant i etterkant.`,+    companyTrips: `Under et bedriftsbesøk reiser studentene til bedriftens lokale for et valgfritt arrangement. Et bedriftsbesøk gir dere som bedrift muligheten til å vise studentene frem hvor de kan jobbe, og bli godt kjent med dem. `,+    companies: `En bedriftspresentasjon gir dere som organisasjon mulighet til å presentere dere for TIHLDE sine studenter. Dette er en gylden mulighet til å gjøre studentene bevisst på hvem dere er, hva dere tilbyr og hvordan dere jobber.+Etter selve presentasjonen reiser vi sammen ned til en resturant for bespisning og mingling med bedriftsrepresentantene.+Vi kan også tilrettelegge for speed intervjuer dersom dette er ønskelig.`,+    instatakeover: `Ved insta-takeover får bedriften ta over instagrammen vår en hel dag. Dere vil få muligheten til å fremme bedriften på valgfri måte, og nå ut direkte til studentene.`,+  };++  return (+    <Navigation+      banner={+        <Banner text='<b>Alle arrangementer kan gjennomføres digitalt våren 2021<b/>' title='For Bedrifter'>+          <Button className={classes.bannerButton} color='primary' onClick={() => scrollToForm()} startIcon={<SendIcon />} variant='outlined'>+            Send oss en melding+          </Button>+        </Banner>+      }+      fancyNavbar+      maxWidth={false}>+      <Helmet>+        <title>For bedrifter</title>+      </Helmet>+      <Container className={classes.section}>+        <Typography align='center' gutterBottom variant='h2'>+          Vi tilbyr+        </Typography>+        <div className={classes.grid}>+          <InfoCard header='Bedriftspresentasjon' justifyText text={text.companies} />+          <InfoCard header='Kurs / Workshop' justifyText text={text.course} />+          <InfoCard header='Bedriftsbesøk' justifyText text={text.companyTrips} />+          <InfoCard header='Annonse' justifyText text={text.ads} />+          <InfoCard className={classes.gridWide} header='Insta-takeover' justifyText text={text.instatakeover} />+        </div>+      </Container>+      <div className={classes.smoke}>+        <Container className={classes.section}>+          <Typography align='center' gutterBottom variant='h2'>+            Studier+          </Typography>+          <div className={classes.grid}>

Enig at dersom man kan css grids, er det bedre enn mu grids. Krever mer forståelse, men er fundamentalt bedre

olros

comment created time in a day

more