Skip to content

[Before Release] UI Polishments #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions app/lib/app.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
* {
font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
}

#create {
box-shadow: none;
background: #18a0fb;
Expand All @@ -8,17 +12,6 @@
box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.3);
}

h1,
h2,
h3,
h4,
h5,
h6,
sub,
p {
font-family: "Helvetica Neue", "Helvetica", "Roboto", "Arial", sans-serif;
}

.jss3 {
background-color: #000 !important;
}
Expand Down
20 changes: 19 additions & 1 deletion app/lib/components/icons-loader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export function IconsLoader() {
);
list = <IconList icons={icons} />;
} else {
list = <LinearProgress />;
list = <StyledLinearProgress />;
}

const handleScroll = () => {
Expand Down Expand Up @@ -388,6 +388,10 @@ const Input = styled.input`
font-weight: 400;
line-height: 17px;
color: #adaeb2;

&::placeholder {
color: #adaeb2;
}
`;

const SearchChecker = styled.div`
Expand Down Expand Up @@ -424,6 +428,20 @@ const SizeCheck = styled.div`
padding: 0px 16px;
`;

const StyledLinearProgress = styled(LinearProgress)`
/* for reset body margin */
margin: 0 -8px;

/* reset material-ui style */
&.color-primary {
background-color: #ecf1ff;
}

&.barColorPrimary {
background-color: #2562ff;
}
`;

const GridItem = styled(GridListTile)`
height: 70px !important;
display: flex;
Expand Down
1 change: 1 addition & 0 deletions app/lib/components/navigation/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./primary-workmode-select";
export * from "./secondary-menu-dropdown";
export * from "./secondary-workmode-choice";
export * from "./secondary-workmode-menu";
export * from "./navigator-expansion-control-button";
Expand Down
94 changes: 94 additions & 0 deletions app/lib/components/navigation/secondary-menu-dropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React from "react";
import { useHistory } from "react-router-dom";
import { WorkMode, WorkScreen } from "../../navigation";
import { SecondaryWorkmodeMenu } from "./secondary-workmode-menu";

type Stage = "production" | "development" | string;
interface Menu {
id: WorkMode | WorkScreen | string;
name: string;
stage: Stage;
onSelect: () => void;
}

export function signinOrLibraryMenu(): Menu {
const history = useHistory();
return {
id: WorkScreen.signin,
name: WorkScreen.signin,
stage: "production",
onSelect: () => {
history.push("/signin");
},
};

//
// TODO: return library menu when signed in.
return {
id: WorkMode.library,
name: WorkMode.library,
stage: "development",
onSelect: () => {},
};
}

export function SecondaryMenuDropdown() {
const history = useHistory();
const menu: Menu[] = [
signinOrLibraryMenu(),
{
id: WorkMode.asset,
name: WorkMode.asset,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.manage,
name: WorkMode.manage,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.tools,
name: WorkMode.tools,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.settings,
name: WorkMode.settings,
stage: "development",
onSelect: () => {},
},
{
id: "feedback-toggle",
name: "Feedback",
stage: "production",
onSelect: () => {
open("https://github.com/gridaco/assistant/issues/new/choose");
},
},
{
id: WorkMode.about,
name: WorkMode.about,
stage: "production",
onSelect: () => {
history.push("/about");
},
},
].filter((m) => {
if (process.env.NODE_ENV == "production") {
return m.stage === "production";
}
return true; /** if not production, return all available menus */
});

return (
<SecondaryWorkmodeMenu<WorkMode | WorkScreen | string>
menus={menu}
onSelect={(id) => {
menu.find((m) => m.id === id)?.onSelect();
}}
/>
);
}
4 changes: 2 additions & 2 deletions app/lib/components/navigation/secondary-workmode-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function SecondaryWorkmodeMenu<T extends string>(props: {
}) {
return (
<Wrapper>
<Column style={{ marginTop: "4px" }}>
<Column style={{ marginTop: "20px" }}>
<Row style={{ marginBottom: "4px" }}>
{props.menus.map((menu, index) => {
if (index < 3) {
Expand All @@ -29,7 +29,7 @@ export function SecondaryWorkmodeMenu<T extends string>(props: {
}
})}
</Row>
<Row>
<Row style={{ marginBottom: "16px" }}>
{props.menus.map((menu, index) => {
if (index >= 3) {
return (
Expand Down
75 changes: 5 additions & 70 deletions app/lib/main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,77 +47,12 @@ import {
WorkmodeScreenTabs,
PrimaryWorkmodeSelect,
NavigatorExpansionControlButton,
SecondaryWorkmodeMenu,
SecondaryMenuDropdown,
} from "../components/navigation";
import styled from "@emotion/styled";
import { Column, Row } from "../components/style/global-style";
import { UploadSteps } from "../components/upload-steps";

function MoreMenus() {
const history = useHistory();
const menu = [
{
id: WorkScreen.signin,
name: WorkScreen.signin,
stage: "production",
onSelect: () => {
history.push("/signin");
},
},
{
id: WorkMode.asset,
name: WorkMode.asset,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.manage,
name: WorkMode.manage,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.tools,
name: WorkMode.tools,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.library,
name: WorkMode.library,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.settings,
name: WorkMode.settings,
stage: "development",
onSelect: () => {},
},
{
id: WorkMode.about,
name: WorkMode.about,
stage: "production",
onSelect: () => {
history.push("/about");
},
},
].filter((m) => {
if (process.env.NODE_ENV == "production") {
return m.stage === "production";
}
return true; /** if not production, return all available menus */
});
return (
<SecondaryWorkmodeMenu<WorkMode | WorkScreen>
menus={menu}
onSelect={(id) => {
menu.find((m) => m.id === id)?.onSelect();
}}
/>
);
}

function Screen(props: { screen: WorkScreen }) {
switch (props.screen) {
case WorkScreen.about:
Expand Down Expand Up @@ -220,10 +155,13 @@ function TabNavigationApp(props: { savedLayout: NavigationStoreState }) {
const [workmodeSet, setWorkmodeSet] = useState<PrimaryWorkmodeSet>(
props.savedLayout.workmodeSet
);
const [tabIndex, setTabIndex] = useState<number>(0);
const [expansion, setExpansion] = useState<boolean>(true);

const on_workmode_select = (workmode: WorkMode) => {
setWorkmode(workmode);
setTabIndex(0);
setExpansion(true);
};

const on_work_select = (index, screen) => {
Expand All @@ -235,9 +173,6 @@ function TabNavigationApp(props: { savedLayout: NavigationStoreState }) {
});
};

const [tabIndex, setTabIndex] = useState<number>(0);
const [expansion, setExpansion] = useState<boolean>(true);

return (
<>
<Wrapper>
Expand All @@ -259,7 +194,7 @@ function TabNavigationApp(props: { savedLayout: NavigationStoreState }) {
onClick={() => setExpansion(!expansion)}
/>
</Row>
{!expansion && <MoreMenus />}
{!expansion && <SecondaryMenuDropdown />}
</Column>
</Wrapper>

Expand Down
11 changes: 8 additions & 3 deletions app/lib/pages/code/code-screen-footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export function CodeScreenFooter(props: ICodeScreenFooter) {
return (
<CodeFooterCtaWrapper>
<NextStepButton
disabled={!props.app}
onClick={() => {
// TODO: the button component should be passed from outer side.
}}
Expand All @@ -54,12 +55,12 @@ export function CodeScreenFooter(props: ICodeScreenFooter) {
}

const CodeFooterCtaWrapper = styled.footer`
padding: 12px 8px;
/* 16 is body's padding */
width: calc(100% - 16px);
padding: 12px 16px;
display: flex;
background: #fff;
position: absolute;
/* 16 is body's padding */
width: calc(100% - 16px);
left: 0;
bottom: 0;

Expand All @@ -79,6 +80,10 @@ const NextStepButton = styled.button`
color: #fff;
background: #17181a;
}
&:disabled {
color: #bbbbbb;
background: #949494;
}
`;

const PreviewButton = styled.button`
Expand Down
4 changes: 3 additions & 1 deletion app/lib/pages/signin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ function fetchUserProfile(): {

const StyledButton = styled.button`
${ButtonStyle}
width: calc(100vw - 54px);
/* 58 is body margin 8*2 + parent padding 21*2 */
width: calc(100vw - 58px);
font-weight: bold;
font-size: 14px;
line-height: 17px;
color: #ffffff;
background: #2562ff;
margin-bottom: 53px;
border: 0;
`;

export default Signin;
19 changes: 15 additions & 4 deletions app/lib/pages/signin/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ export const BackIcon = styled.div`
`;

export const Inner = styled.div`
margin-top: 120px;
margin-top: 60px;

@media (min-height: 800px) {
margin-top: 120px;
}
`;

export const Title = styled.h2`
Expand All @@ -33,9 +37,13 @@ export const Title = styled.h2`
`;

export const BtnWrapper = styled.div`
margin-top: 391px;
/* margin-top: 391px; */
position: absolute;
bottom: 120px;
bottom: 60px;

@media (min-height: 800px) {
bottom: 120px;
}
`;

export const SignInBtn = styled.button`
Expand Down Expand Up @@ -71,7 +79,10 @@ export const Contents = styled.h6`
`;

export const LinkWrapper = styled(Column)`
margin-top: 90px;
margin-top: 45px;
@media (min-height: 800px) {
margin-top: 90px;
}
`;

export const LinkContents = styled.a`
Expand Down
Loading