Skip to content

Commit

Permalink
Bunch of small UI fixes
Browse files Browse the repository at this point in the history
refs -
  • Loading branch information
Oksamies committed Nov 6, 2023
1 parent 5c5c3b2 commit e44a914
Show file tree
Hide file tree
Showing 30 changed files with 391 additions and 142 deletions.
2 changes: 1 addition & 1 deletion packages/cyberstorm-styles/src/styles/theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
--color-success-background: var(--color-green--8);
--color-success-background--hover: var(--color-green--9);
--color-crown: var(--color-yellow--5);
--color-info: var(--color-blue--60);
--color-info: var(--color-blue--70);
--color-info-background: var(--color-blue--10);
--color-surface--0: var(--color-purple--0);
--color-surface--1: var(--color-purple--1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@
border-radius: var(--border-radius--8);

object-fit: cover;
box-shadow: var(--box-shadow-default);
transition: 0.2s;
aspect-ratio: 3 / 4;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const DevelopersDropDown = () => (
triggerColorScheme="transparentDefault"
trigger={
<Button.Root paddingSize="large">
<Button.ButtonLabel fontSize="large">Developers</Button.ButtonLabel>
<Button.ButtonLabel fontSize="large" fontWeight="600">
Developers
</Button.ButtonLabel>
<Button.ButtonIcon>
<FontAwesomeIcon icon={faCaretDown} />
</Button.ButtonIcon>
Expand Down
10 changes: 5 additions & 5 deletions packages/cyberstorm/src/components/Header/Header.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
display: flex;
gap: var(--gap--32);
align-items: center;
justify-content: space-between;
width: 100%;
height: 3.5rem;
padding: 0 var(--space--24);
border-bottom: var(--space--px) var(--color-surface--4) solid;
background-color: hsl(240deg 36% 11% / 0.9);
backdrop-filter: blur(var(--space--20));
background-color: rgb(16 16 40 / 0.85);
backdrop-filter: blur(10px);
}

.item {
Expand All @@ -26,6 +25,7 @@

.item:last-child {
justify-content: flex-end;
padding-right: 0.75rem;
}

.nav {
Expand All @@ -47,13 +47,13 @@
width: 1.655rem;
height: 1.463rem;
margin: 0 var(--space--18);
margin: 0 0.75rem 0 1.25rem;
color: var(--color-highlight);
}

.navButtons {
display: flex;
gap: var(--space--8);
min-width: 252px;
}

.dropDownUserInfo {
Expand Down
13 changes: 7 additions & 6 deletions packages/cyberstorm/src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import * as Button from "../Button/";
import { CommunitiesLink, IndexLink, PackageUploadLink } from "../Links/Links";
import { ThunderstoreLogo } from "../../svg/svg";
import { UserDropDown } from "./UserDropDown";
import { classnames } from "../../utils/utils";

/**
* Horizontal navigation bar shown at the top of the site.
Expand Down Expand Up @@ -44,7 +43,7 @@ export function Header() {
paddingSize="large"
colorScheme="transparentDefault"
>
<Button.ButtonLabel fontSize="large">
<Button.ButtonLabel fontSize="large" fontWeight="600">
Communities
</Button.ButtonLabel>
</Button.Root>
Expand All @@ -56,19 +55,21 @@ export function Header() {
</ul>
</nav>

<div className={classnames(styles.item, styles.search)}></div>

<nav className={styles.item}>
<ul className={styles.nav}>
<li className={styles.navButtons}>
<a href="/">
<Button.Root paddingSize="large" colorScheme="specialPurple">
<Button.ButtonLabel>Go Premium</Button.ButtonLabel>
<Button.ButtonLabel fontWeight="600">
Go Premium
</Button.ButtonLabel>
</Button.Root>
</a>
<a href="/">
<Button.Root paddingSize="large" colorScheme="accent">
<Button.ButtonLabel>Get Manager</Button.ButtonLabel>
<Button.ButtonLabel fontWeight="800">
Get Manager
</Button.ButtonLabel>
</Button.Root>
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
.main {
display: flex;
flex-direction: column;
gap: 4rem;
gap: 2rem;
}

@media (min-width: 60rem) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { CommunitiesLink, CommunityLink } from "../../Links/Links";
import { MetaItem } from "../../MetaItem/MetaItem";
import { PackageSearch } from "../../PackageSearch/PackageSearch";
import { formatInteger } from "../../../utils/utils";
import { faArrowUpRight } from "@fortawesome/pro-solid-svg-icons";

interface Props {
communityId: string;
Expand Down Expand Up @@ -72,6 +73,9 @@ export function CommunityProfileLayout(props: Props) {
<FontAwesomeIcon icon={faDiscord} />
</Button.ButtonIcon>
<Button.ButtonLabel>Join our community</Button.ButtonLabel>
<Button.ButtonIcon>
<FontAwesomeIcon icon={faArrowUpRight} />
</Button.ButtonIcon>
</Button.Root>
</a>
) : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,10 @@
max-height: 9rem;
border-radius: var(--border-radius--8);
}

.categoriesCard {
display: flex;
flex-flow: row wrap;
gap: 0.5rem;
row-gap: 0.5rem;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from "../../Links/Links";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import * as Button from "../../Button/";
import { Title } from "../../Title/Title";
import { Dialog } from "../../Dialog/Dialog";
import { PackageManagementForm } from "./PackageManagementForm/PackageManagementForm";
import { BaseLayout } from "../BaseLayout/BaseLayout";
Expand All @@ -20,29 +19,33 @@ import {
faCog,
faThumbsUp,
faFlag,
faCodeBranch,
faFileLines,
faFilePlus,
faArrowUpRight,
faBoxes,
} from "@fortawesome/pro-solid-svg-icons";
import { faUsers } from "@fortawesome/pro-regular-svg-icons";
import { PackageDependencyList } from "./PackageDependencyList/PackageDependencyList";
import { CopyButton } from "../../CopyButton/CopyButton";
import { formatInteger } from "../../../utils/utils";
import { bankersRound, formatInteger } from "../../../utils/utils";
import { useState } from "react";
import { Tabs } from "../../Tabs/Tabs";
import { PackageChangeLog } from "./PackageChangeLog/PackageChangeLog";
import { PackageVersions } from "./PackageVersions/PackageVersions";
import { faDiscord, faGithub } from "@fortawesome/free-brands-svg-icons";
import {
faCodeBranch,
faFileLines,
faFilePlus,
faArrowUpRight,
} from "@fortawesome/pro-regular-svg-icons";
import { PageHeader } from "../BaseLayout/PageHeader/PageHeader";
import { useDapper } from "@thunderstore/dapper";
import { Package } from "@thunderstore/dapper/types";
import { PackageTagList } from "./PackageTagList/PackageTagList";
import { PackageTeamMemberList } from "./PackageTeamMemberList/PackageTeamMemberList";
import { ThunderstoreLogo } from "../../../svg/svg";
import { usePromise } from "@thunderstore/use-promise";
import { WrapperCard } from "../../WrapperCard/WrapperCard";
import { Tag } from "../../Tag/Tag";
import { Icon } from "../../Icon/Icon";
import { PLACEHOLDER } from "../Developers/MarkdownPreview/MarkdownPlaceholder";
import markdownStyles from "../../Markdown/Markdown.module.css";

export interface PackageDetailLayoutProps {
community: string;
Expand Down Expand Up @@ -71,6 +74,19 @@ export function PackageDetailLayout(props: PackageDetailLayoutProps) {

const [currentTab, setCurrentTab] = useState(1);

const mappedPackageTagList = packageData.categories?.map(
(category, index) => {
return (
<Tag
colorScheme="borderless_no_hover"
size="mediumPlus"
key={index.toString()}
label={category.name.toUpperCase()}
/>
);
}
);

const packageDetailsMeta = [];
if (packageData.author) {
packageDetailsMeta.push(
Expand Down Expand Up @@ -240,7 +256,20 @@ export function PackageDetailLayout(props: PackageDetailLayoutProps) {
</Button.Root>
</div>
<MetaInfoItemList metaInfoData={metaInfoData} />
<PackageTagList tags={packageData.categories} />
<WrapperCard
title="Categories"
content={
<div className={styles.categoriesCard}>
{mappedPackageTagList}
</div>
}
headerIcon={
<Icon>
<FontAwesomeIcon icon={faBoxes} />
</Icon>
}
/>
<PackageTagList packageData={packageData} />
<PackageDependencyList namespace={namespace} community={community} />
<PackageTeamMemberList
community={packageData.community}
Expand Down Expand Up @@ -279,6 +308,11 @@ function getMetaInfoData(packageData: Package) {
},
{
key: "5",
label: "Size",
content: <>{`${bankersRound(packageData.size / 1000, 1)} MB`}</>,
},
{
key: "6",
label: "Dependency string",
content: (
<div className={styles.dependencyStringWrapper}>
Expand All @@ -293,7 +327,7 @@ function getMetaInfoData(packageData: Package) {
),
},
{
key: "6",
key: "7",
label: "Dependants",
content: (
<PackageDependantsLink
Expand Down Expand Up @@ -329,13 +363,14 @@ const tabs = [
];

function getTabContent(currentTab: number, packageData: Package) {
const placeholder = PLACEHOLDER();
let tabContent = null;
if (currentTab === 1) {
tabContent = (
<>
<Title text={packageData.name} />
<p className={styles.description}>{packageData.description}</p>
</>
<div
dangerouslySetInnerHTML={{ __html: placeholder }}
className={markdownStyles.root}
/>
);
} else if (currentTab === 2) {
tabContent = <PackageChangeLog packageId={packageData.name} />;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.list {
display: flex;
flex-flow: row wrap;
gap: var(--gap--4);
padding: var(--space--16);
gap: var(--gap--8);
}
Original file line number Diff line number Diff line change
@@ -1,36 +1,98 @@
import styles from "./PackageTagList.module.css";
import { PackageCategory } from "@thunderstore/dapper/types";
import { Package } from "@thunderstore/dapper/types";
import { WrapperCard } from "../../../WrapperCard/WrapperCard";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faTag } from "@fortawesome/pro-regular-svg-icons";
import { Tag } from "../../../Tag/Tag";
import {
faThumbtack,
faWarning,
faLips,
faSparkles,
} from "@fortawesome/pro-solid-svg-icons";
import { bankersRound } from "../../../../utils/utils";
import { ReactNode } from "react";

export interface PackageTagListProps {
tags?: PackageCategory[];
packageData: Package;
}

export function PackageTagList(props: PackageTagListProps) {
const { tags = [] } = props;

const mappedPackageTagList = tags?.map((category, index) => {
return (
<Tag
colorScheme="borderless_no_hover"
key={index.toString()}
label={category.name.toUpperCase()}
/>
);
});
const { packageData } = props;

return (
<>
<WrapperCard
title="Tags"
content={<div className={styles.list}>{mappedPackageTagList}</div>}
content={
<div className={styles.list}>{getPackageFlags(packageData)}</div>
}
headerIcon={<FontAwesomeIcon icon={faTag} />}
/>
</>
);
}

PackageTagList.displayName = "PackageTagList";

function getPackageFlags(packageData: Package) {
const updateTimeDelta = bankersRound(
(Date.now() - Date.parse(packageData.lastUpdated)) / 86400000,
0
);
const isNew = updateTimeDelta < 3;
if (
!packageData.isPinned &&
!packageData.isNsfw &&
!packageData.isDeprecated &&
!isNew
) {
return null;
}
const flagList: ReactNode[] = [];
if (packageData.isPinned) {
flagList.push(
<Tag
key="flag_pinned"
label="Pinned"
colorScheme="blue"
size="mediumPlus"
leftIcon={<FontAwesomeIcon icon={faThumbtack} />}
/>
);
}
if (packageData.isDeprecated) {
flagList.push(
<Tag
key="flag_deprecated"
label="Deprecated"
colorScheme="yellow"
size="mediumPlus"
leftIcon={<FontAwesomeIcon icon={faWarning} />}
/>
);
}
if (packageData.isNsfw) {
flagList.push(
<Tag
key="flag_nsfw"
label="NSFW"
colorScheme="pink"
size="mediumPlus"
leftIcon={<FontAwesomeIcon icon={faLips} />}
/>
);
}
if (isNew) {
flagList.push(
<Tag
key="flag_nsfw"
label="New"
colorScheme="green"
size="mediumPlus"
leftIcon={<FontAwesomeIcon icon={faSparkles} />}
/>
);
}
return flagList;
}
Loading

0 comments on commit e44a914

Please sign in to comment.