Skip to content

Commit

Permalink
refactor: remove unused declarations
Browse files Browse the repository at this point in the history
Signed-off-by: Elizabeth Kelen <[email protected]>
  • Loading branch information
ekelen committed Nov 9, 2020
1 parent 9181af6 commit d1f67fe
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 60 deletions.
82 changes: 39 additions & 43 deletions web/src/ui/components/AuthedHeaderContents/AuthedHeaderContents.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
import { faCube, faSyncAlt } from "@fortawesome/free-solid-svg-icons";
import { faSyncAlt } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import React, { useContext, useMemo } from "react";
import { Check, GitBranch, LogOut, X } from "react-feather";
import React, { useContext } from "react";
import { GitBranch, LogOut } from "react-feather";
import { removeAuthCookie } from "../../../api/cookies";
import IconChat from "../../../assets/svg/IconChat";
import IconProjectBertyMessenger from "../../../assets/svg/IconProjectBertyMessenger";
// import IconChat from "../../../assets/svg/IconChat";
// import IconProjectBertyMessenger from "../../../assets/svg/IconProjectBertyMessenger";
import {
actions,
ARTIFACT_VALUE_KIND,
BUILD_DRIVERS,
BUILD_DRIVER_TO_NAME,
BUILD_STATES,
BUILD_STATE_VALUE_TO_NAME,
PROJECT,
PROJECT_NAME,
USERAGENT,
} from "../../../constants";
import { useRedirectHome } from "../../../hooks/queryHooks";
import { GlobalContext } from "../../../store/GlobalStore.js";
import { getMobileOperatingSystem } from "../../../util/browser";
import { getIsArrayWithN } from "../../../util/getters.js";
import { getArtifactKindIcon } from "../../styleTools/brandIcons.js";
import OutlineWidget from "../OutlineWidget/OutlineWidget.js";
Expand All @@ -38,8 +34,8 @@ const AuthedHeaderContents = () => {
build_driver: buildDrivers,
build_state: buildStates,
},
userAgent,
calculatedFilters: { projects },
// userAgent,
// calculatedFilters: { projects },
},
updateState,
logoutAction,
Expand All @@ -50,41 +46,41 @@ const AuthedHeaderContents = () => {
updateState({ showingFilterModal: true });
};

const isMobile = useMemo(() => {
const localUserAgent = userAgent || getMobileOperatingSystem();
return (
localUserAgent === USERAGENT.iOS || localUserAgent === USERAGENT.Android
);
}, [userAgent]);
// const isMobile = useMemo(() => {
// const localUserAgent = userAgent || getMobileOperatingSystem();
// return (
// localUserAgent === USERAGENT.iOS || localUserAgent === USERAGENT.Android
// );
// }, [userAgent]);

const FilterMessenger = () =>
projects.includes(PROJECT.messenger) && (
<OutlineWidget
interactive
selected
onClick={() => updateState({ showingFilterModal: true })}
iconComponent={<IconChat size="20px" />}
title={PROJECT_NAME[PROJECT.messenger]}
/>
);
// const FilterMessenger = () =>
// projects.includes(PROJECT.messenger) && (
// <OutlineWidget
// interactive
// selected
// onClick={() => updateState({ showingFilterModal: true })}
// iconComponent={<IconChat size="20px" />}
// title={PROJECT_NAME[PROJECT.messenger]}
// />
// );

const FilterGoIpfs = () =>
projects.includes(PROJECT["gomobile-ipfs-demo"]) && (
<OutlineWidget
interactive
selected
onClick={openFilterModal}
iconComponent={<FontAwesomeIcon icon={faCube} size="lg" />}
text={PROJECT["gomobile-ipfs-demo"]}
/>
);
// const FilterGoIpfs = () =>
// projects.includes(PROJECT["gomobile-ipfs-demo"]) && (
// <OutlineWidget
// interactive
// selected
// onClick={openFilterModal}
// iconComponent={<FontAwesomeIcon icon={faCube} size="lg" />}
// text={PROJECT["gomobile-ipfs-demo"]}
// />
// );

const FiltersAppWidget = () => (
<>
<FilterMessenger />
<FilterGoIpfs />
</>
);
// const FiltersAppWidget = () => (
// <>
// <FilterMessenger />
// <FilterGoIpfs />
// </>
// );

const ArtifactKindsFilter = () =>
getIsArrayWithN(artifactKinds, 1) && (
Expand Down
2 changes: 0 additions & 2 deletions web/src/ui/components/Build/FeedItemWidgets.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { faGithub } from "@fortawesome/free-brands-svg-icons";
import {
faAlignLeft,
faChevronCircleDown,
faChevronCircleUp,
faFile,
faHammer,
faPencilAlt,
Expand Down
19 changes: 7 additions & 12 deletions web/src/ui/components/FilterModal/FilterModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import {
ARTIFACT_KINDS,
BUILD_DRIVERS,
BUILD_STATES,
PROJECT,
PROJECTS,
} from "../../../constants";
import { useRedirectHome } from "../../../hooks/queryHooks";
import { GlobalContext } from "../../../store/GlobalStore";
Expand All @@ -31,10 +29,9 @@ import {
BranchFilter,
BuildDriverFilter,
BuildStateFilter,
ProjectFilter,
} from "./FilterModalWidgets";

const ProjectWidgets = ({
/* const ProjectWidgets = ({
selectedArtifactKinds,
setSelectedArtifactKinds,
selectedProjects,
Expand All @@ -54,7 +51,7 @@ const ProjectWidgets = ({
/>
))}
</>
);
); */

const ArtifactKindWidgets = ({
setSelectedArtifactKinds,
Expand Down Expand Up @@ -96,16 +93,14 @@ const BuildStateWidgets = ({ selectedBuildStates, setSelectedBuildStates }) => (
);

const FilterModal = ({ closeAction: onClose = () => {} }) => {
const { state, updateState, dispatch, logoutAction } = useContext(
GlobalContext
);
const { state, dispatch, logoutAction } = useContext(GlobalContext);
const { redirectHome } = useRedirectHome();
const [selectedDrivers, setSelectedDrivers] = useState([
...state.uiFilters.build_driver,
]);
const [selectedProjects, setSelectedProjects] = useState([
/* const [selectedProjects, setSelectedProjects] = useState([
...state.calculatedFilters.projects,
]);
]); */
const [selectedArtifactKinds, setSelectedArtifactKinds] = useState([
...state.uiFilters.artifact_kinds,
]);
Expand All @@ -116,14 +111,14 @@ const FilterModal = ({ closeAction: onClose = () => {} }) => {
const history = useHistory();

const handleApplyFilters = () => {
window.localStorage.setItem("projects", JSON.stringify(selectedProjects));
/* window.localStorage.setItem("projects", JSON.stringify(selectedProjects));
updateState({
isLoaded: false,
needsRefresh: true,
calculatedFilters: {
projects: [...selectedProjects],
},
});
}); */
onClose();
const uiFilters = {
build_driver: selectedDrivers,
Expand Down
2 changes: 1 addition & 1 deletion web/src/ui/components/Header/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GlobalContext } from "../../../store/GlobalStore";
import cstyles from "./Header.module.css";

const Header = ({ children }) => {
const { state, updateState } = useContext(GlobalContext);
const { updateState } = useContext(GlobalContext);
const history = useHistory();

return (
Expand Down
4 changes: 2 additions & 2 deletions web/src/ui/styleTools/themes.old.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const _themes = {
/* const _themes = {
light: {
name: "light",
bg: {
Expand Down Expand Up @@ -95,7 +95,7 @@ const _themes = {
block: "none",
},
},
};
}; */

export const colors = {
gitHub: {
Expand Down

0 comments on commit d1f67fe

Please sign in to comment.