Skip to content

Commit

Permalink
chore(rr): update naming; fixed constants
Browse files Browse the repository at this point in the history
  • Loading branch information
seaerchin committed Mar 27, 2023
1 parent 1be4dc9 commit 7bf1cf9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 37 deletions.
5 changes: 3 additions & 2 deletions src/layouts/ResourceCategory/components/ResourceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
HStack,
Box,
} from "@chakra-ui/react"
import { Card, CardBody, CardFooter } from "components/Card"
import { ContextMenu } from "components/ContextMenu"
import {
BiChevronRight,
BiEditAlt,
Expand All @@ -20,6 +18,9 @@ import {
} from "react-icons/bi"
import { Link as RouterLink, useRouteMatch } from "react-router-dom"

import { Card, CardBody, CardFooter } from "components/Card"
import { ContextMenu } from "components/ContextMenu"

import { BxFileArchiveSolid } from "assets"
import { ResourcePageData } from "types/directory"
import { prettifyDate } from "utils"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,16 +347,16 @@ export const RequestOverview = ({
// NOTE: Pass `undefined` to avoid users being able to click
// despite being visually disabled.
href={
row.original.type === "page" && row.original.fileUrl
row.original.type === "page" && row.original.cmsFileUrl
? // NOTE: Permalinks are enforced to start with a `/` by our CMS
row.original.fileUrl
row.original.cmsFileUrl
: undefined
}
isExternal
>
<IconButton
isDisabled={
!(row.original.type === "page" && row.original.fileUrl)
!(row.original.type === "page" && row.original.cmsFileUrl)
}
icon={<BiEditAlt />}
aria-label="edit file"
Expand All @@ -377,7 +377,7 @@ export const RequestOverview = ({
aria-label="view file on staging"
variant="link"
isDisabled={
!(row.original.type === "page" && row.original.fileUrl)
!(row.original.type === "page" && row.original.cmsFileUrl)
}
/>
</Link>
Expand Down Expand Up @@ -421,7 +421,7 @@ export const RequestOverview = ({
ref={inputRef}
onSearchIconClick={handleExpansion}
isExpanded={isExpanded}
onSearch={table.getColumn("itemName").setFilterValue}
onSearch={table.getColumn("itemName")!.setFilterValue}
onBlur={handleCollapse}
/>
</Flex>
Expand Down
38 changes: 9 additions & 29 deletions src/mocks/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,34 +239,30 @@ export const MOCK_SITE_DASHBOARD_INFO: SiteDashboardInfo = {

export const MOCK_ITEMS: EditedItemProps[] = [
{
type: ["page"],
type: "page",
name: "A page",
path: ["some", "thing"],
stagingUrl: "www.google.com",
fileUrl: "www.google.com",
cmsFileUrl: "www.google.com",
lastEditedBy: "asdf",
lastEditedTime: 129823104094,
},
{
type: ["nav"],
type: "nav",
name: "A nav",
path: ["some", "thing"],
stagingUrl: "www.google.com",
fileUrl: "www.google.com",
lastEditedBy: "asdf",
lastEditedTime: 823104823094,
},
{
type: ["file"],
type: "file",
name: "a file",
path: ["some", "thing"],
stagingUrl: "www.google.com",
fileUrl: "www.google.com",
lastEditedBy: "asdf",
lastEditedTime: 129823104823094,
},
{
type: ["setting"],
type: "setting",
name:
"A setting with an extremely long title that probably can't fit into a single line and we have to truncate this somehow. so we will hopefully display an ellipsis over it",
// NOTE: We don't have arbitrary nested folders.
Expand All @@ -276,37 +272,20 @@ export const MOCK_ITEMS: EditedItemProps[] = [
"might not be able to fit into a single line",
"so we have to truncate it to show an ellipsis at the end",
],
stagingUrl: "www.google.com",
fileUrl: "www.google.com",
lastEditedBy: "asdf",
lastEditedTime: 129823094,
},
{
type: ["setting"],
type: "setting",
name: "a normal setting",
path: ["some", "thing"],
stagingUrl: "www.google.com",
fileUrl: "www.google.com",
lastEditedBy: "asdf",
lastEditedTime: 12123498294,
},
{
type: ["image"],
type: "image",
name: "some file",
path: ["some", "thing"],
stagingUrl: "www.google.com",
fileUrl: "www.google.com",
lastEditedBy: "asdf",
lastEditedTime: 129823094,
},
{
// NOTE: This has 2 types - we tiebreak by using the first item in the array for the icon.
// For the filtering, it should appear in both.
type: ["nav", "setting"],
name: "a file with two types",
path: ["another", "path"],
stagingUrl: "www.google.com",
fileUrl: "www.google.com",
lastEditedBy: "asdf",
lastEditedTime: 129823094,
},
Expand Down Expand Up @@ -448,10 +427,11 @@ export const MOCK_COMMENTS_DATA: CommentData[] = [
]

const MOCK_EDITED_ITEM: EditedItemProps = {
type: ["file"],
type: "page",
name: "mock item",
path: ["some", "path"],
stagingUrl: "isomer.sg",
cmsFileUrl: "localhost:3000",
lastEditedBy: "a user",
lastEditedTime: Date.now(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/types/reviewRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export type WithEditMeta<T> = T & {
export interface EditedPageDto extends BaseEditedItemDto {
type: "page"
stagingUrl: string
fileUrl: string
cmsFileUrl: string
}

export interface EditedConfigDto extends BaseEditedItemDto {
Expand Down

0 comments on commit 7bf1cf9

Please sign in to comment.