Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
sidyakinian committed Dec 7, 2023
1 parent d8dcca0 commit 91759c9
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 68 deletions.
60 changes: 30 additions & 30 deletions pages/FeatureFlags/HackathonFeatureFlags.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
import styled from 'styled-components';
import { useEffect, useState } from 'react';
import Page from '../../components/page';
import styled from 'styled-components'
import { useEffect, useState } from 'react'
import Page from '../../components/page'
import Card, {

Check failure on line 4 in pages/FeatureFlags/HackathonFeatureFlags.js

View workflow job for this annotation

GitHub Actions / Linting

Replace `⏎··CardHeader,⏎··CardButtonContainer,⏎··CardTitle,⏎··CardContent,⏎` with `·CardHeader,·CardButtonContainer,·CardTitle,·CardContent·`
CardHeader,
CardButtonContainer,
CardTitle,
CardContent,
} from '../../components/card';
import Button from '../../components/button';
import FeatureFlag from '../../components/FeatureFlag';
import { COLOR, EDIT, HACKATHON_NAVBAR } from '../../constants';
} from '../../components/card'
import Button from '../../components/button'
import FeatureFlag from '../../components/FeatureFlag'
import { COLOR, EDIT, HACKATHON_NAVBAR } from '../../constants'
import {
getTimestamp,
subscribeToFlags,
formatDate,
updateFlags,
getHackathonPaths,

Check failure on line 18 in pages/FeatureFlags/HackathonFeatureFlags.js

View workflow job for this annotation

GitHub Actions / Linting

'getHackathonPaths' is defined but never used
getHackathons,

Check failure on line 19 in pages/FeatureFlags/HackathonFeatureFlags.js

View workflow job for this annotation

GitHub Actions / Linting

'getHackathons' is defined but never used
} from '../../utility/firebase';
import { useAuth } from '../../utility/auth';
} from '../../utility/firebase'
import { useAuth } from '../../utility/auth'

const InlineButton = styled.span`
display: inline;
float: right;
margin: 0 16px;
padding-bottom: 32px;
`;
`

const InlineButtonContainer = styled.div`
display: inline-block;
float: right;
margin-top: -40px;
`;
`
export default function HackathonFeatureFlags({ id, hackathons }) {
const [editing, setEditing] = useState(false);
const [flags, setFlags] = useState({});
const [editedFlags, setEditedFlags] = useState({});
const { email: user } = useAuth().user;
const [editing, setEditing] = useState(false)
const [flags, setFlags] = useState({})
const [editedFlags, setEditedFlags] = useState({})
const { email: user } = useAuth().user
useEffect(() => {
return subscribeToFlags(id, setFlags);
}, [window.location.href]);
return subscribeToFlags(id, setFlags)
}, [window.location.href])

useEffect(() => {
if (!editing) {
setEditedFlags({});
setEditedFlags({})
}
}, [editing]);
}, [editing])

const saveFlags = async () => {
const updateObj = editedFlags;
updateObj.lastEdited = getTimestamp();
updateObj.lastEditedBy = user;
await updateFlags(id, updateObj);
setEditing(false);
};
const updateObj = editedFlags
updateObj.lastEdited = getTimestamp()
updateObj.lastEditedBy = user
await updateFlags(id, updateObj)
setEditing(false)
}

const EditFlagsComponent = () => (
<>
Expand Down Expand Up @@ -95,9 +95,9 @@ export default function HackathonFeatureFlags({ id, hackathons }) {
<>
{Object.entries(flags).map(([key, value]) => {
if (key === 'lastEdited' || key === 'lastEditedBy') {
return null;
return null
}
return <FeatureFlag disabled title={key} value={value} />;
return <FeatureFlag disabled title={key} value={value} />
})}
</>
);

Check failure on line 103 in pages/FeatureFlags/HackathonFeatureFlags.js

View workflow job for this annotation

GitHub Actions / Linting

Delete `;`
Expand Down Expand Up @@ -135,10 +135,10 @@ export default function HackathonFeatureFlags({ id, hackathons }) {
type={EDIT}
onClick={() => {
if (editing) {
setEditing(false);
setEditing(false)
} else {
setEditedFlags(flags);
setEditing(true);
setEditedFlags(flags)
setEditing(true)
}
}}
/>
Expand Down
68 changes: 34 additions & 34 deletions pages/FeatureFlags/Hiring.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,51 +86,51 @@ export default function Hiring({ id, hackathons }) {
}

const saveFlags = async () => {
const updateObj = editedFlags;
updateObj.lastEdited = getTimestamp();
updateObj.lastEditedBy = user;
await updateFlags(id, updateObj);
};
const updateObj = editedFlags
updateObj.lastEdited = getTimestamp()
updateObj.lastEditedBy = user
await updateFlags(id, updateObj)
}

const saveHiringSettings = async () => {
const updateObj = editedHiringSettings;
updateObj.lastEdited = getTimestamp();
updateObj.lastEditedBy = user;
await updateHiringSettings(updateObj);
};
const updateObj = editedHiringSettings
updateObj.lastEdited = getTimestamp()
updateObj.lastEditedBy = user
await updateHiringSettings(updateObj)
}

const saveCtaLink = async () => {
await updateCtaLink(editedCtaLink)
};
}

const handleHiringSettingsChange = (key, newValue) => {
setEditedHiringSettings({
...editedHiringSettings,
[key]: newValue
...editedHiringSettings,
[key]: newValue,
})
};
}

/*
* Converts a string from "thisTypeOfCase" to "This type of case"
*/
const stringFromKey = (key) => {
const isUpperCase = (i) => {
const stringFromKey = key => {
const isUpperCase = i => {
return key[i] === key[i].toUpperCase()
}
let keyString = '';
let keyString = ''
for (let i = 0; i < key.length; i++) {
if (i == 0) {
keyString += key[i].toUpperCase();
continue;
if (i === 0) {
keyString += key[i].toUpperCase()
continue
}
if (isUpperCase(i) && !isUpperCase(i + 1)) {
keyString += ' ';
keyString += key[i].toLowerCase();
keyString += ' '
keyString += key[i].toLowerCase()
} else {
keyString += key[i];
keyString += key[i]
}
}
return keyString;
return keyString
}

if (!flags) {
Expand Down Expand Up @@ -166,12 +166,12 @@ export default function Hiring({ id, hackathons }) {
type={EDIT}
onClick={() => {
if (editing) {
setEditing(false);
setEditing(false)
} else {
setEditedCtaLink(ctaLink);
setEditedFlags(flags);
setEditedHiringSettings(hiringSettings);
setEditing(true);
setEditedCtaLink(ctaLink)
setEditedFlags(flags)
setEditedHiringSettings(hiringSettings)
setEditing(true)
}
}}
/>
Expand All @@ -188,7 +188,7 @@ export default function Hiring({ id, hackathons }) {
/>
{Object.entries(editedFlags).map(([key, value]) => {
if (key === 'lastEdited' || key === 'lastEditedBy') {
return null;
return null
}
return (
<FeatureFlag
Expand All @@ -198,14 +198,14 @@ export default function Hiring({ id, hackathons }) {
setEditedFlags({
...editedFlags,
[key]: !value,
});
})
}}
/>
);
})}
{Object.entries(editedHiringSettings).map(([key, value]) => {
if (key === 'lastEdited' || key === 'lastEditedBy') {
return null;
return null
}
return (
<div>
Expand Down Expand Up @@ -241,13 +241,13 @@ export default function Hiring({ id, hackathons }) {
</Group>
{Object.entries(flags).map(([key, value]) => {
if (key === 'lastEdited' || key === 'lastEditedBy') {
return null;
return null
}
return <FeatureFlag disabled title={key} value={value} />;
})}
{Object.entries(hiringSettings).map(([key, value]) => {
if (key === 'lastEdited' || key === 'lastEditedBy') {
return null;
return null
}
return <Group>
<Label>{stringFromKey(key)}</Label>
Expand Down
8 changes: 4 additions & 4 deletions pages/[id]/FeatureFlags.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Hiring from '../FeatureFlags/Hiring';
import HackathonFeatureFlags from '../FeatureFlags/HackathonFeatureFlags';
import Hiring from '../FeatureFlags/Hiring'
import HackathonFeatureFlags from '../FeatureFlags/HackathonFeatureFlags'
import {
getHackathonPaths,
getHackathons,
} from '../../utility/firebase';
} from '../../utility/firebase'

export default ({ id, hackathons }) => {
return id === 'www' ? <Hiring id={id} hackathons={hackathons} /> : <HackathonFeatureFlags id={id} hackathons={hackathons}/>;
return id === 'www' ? <Hiring id={id} hackathons={hackathons} /> : <HackathonFeatureFlags id={id} hackathons={hackathons}/>
}

export const getStaticPaths = async () => {
Expand Down

0 comments on commit 91759c9

Please sign in to comment.