Skip to content

Commit

Permalink
Merge branch 'develop' into feat/upgrade-to-node-18-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-funk committed Jan 2, 2024
2 parents 3d2d35d + e2050c8 commit 096e601
Show file tree
Hide file tree
Showing 48 changed files with 1,885 additions and 145 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ coverage
node_modules
**/node_modules

# don't include utilities
utilities/

# don't include any logs
npm-debug.log*
**/npm-debug.log*
Expand Down
4 changes: 2 additions & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "8.6.3",
"version": "8.6.5",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
Expand Down
6 changes: 3 additions & 3 deletions client/src/core/client/admin/components/AutoLoadMore.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { FunctionComponent, useEffect } from "react";

import { useInView } from "coral-framework/lib/intersection";
import { BaseButton, Spinner } from "coral-ui/components/v2";
import { Button, Spinner } from "coral-ui/components/v2";

interface Props {
disableLoadMore?: boolean;
Expand All @@ -27,9 +27,9 @@ const AutoLoadMoresContainer: FunctionComponent<Props> = ({
// button here to make it testable.
if (process.env.NODE_ENV === "test") {
return (
<BaseButton onClick={onLoadMore} disabled={disableLoadMore}>
<Button onClick={onLoadMore} disabled={disableLoadMore} variant="text">
Load More
</BaseButton>
</Button>
);
}
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ const markers: Array<
</Localized>
)) ||
null,
(c) =>
(c.status === "PREMOD" &&
c.author &&
c.author.premoderatedBecauseOfEmailAt && (
<Localized id="moderate-marker-preMod-userEmail" key={keyCounter++}>
<Marker color="pending">User email</Marker>
</Localized>
)) ||
null,
(c) =>
(c.revision &&
c.revision.actionCounts.flag.reasons.COMMENT_DETECTED_LINKS && (
Expand Down Expand Up @@ -239,6 +248,9 @@ const enhanced = withFragmentContainer<MarkersContainerProps>({
tags {
code
}
author {
premoderatedBecauseOfEmailAt
}
revision {
actionCounts {
illegal {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,48 @@

.wrapper {
overflow: hidden;
/* adjust for button line-height being > 1 */
margin-top: -2px;
white-space: nowrap;
text-overflow: ellipsis;
}

.button {
color: var(--palette-text-500) !important;
border-width: 0;
width: calc(20 * var(--mini-unit));
margin-right: calc(var(--spacing-1) / 2);
padding-left: var(--spacing-1);
font-size: var(--font-size-3);
font-family: var(--font-family-primary);
font-weight: var(--font-weight-primary-bold);
line-height: 1.2;
justify-content: space-between;
justify-content: flex-start;
align-items: center;
background: var(--palette-background-input);
}

.filterInput {
resize: none;
height: 100%;
width: auto;
overflow: hidden;
margin-left: var(--spacing-1);
margin-right: var(--spacing-1);
}

.filterInput > textarea {
resize: none;
overflow: hidden;
sizing: border-box;
color: var(--palette-grey-400);
}

.buttonIconLeft {
width: 20px;
margin-right: calc(var(--spacing-1) / 2);
}

.buttonIconRight {
align-self: baseline;
margin-left: auto;
margin-right: var(--spacing-1);
width: 16px;
}

Expand All @@ -40,8 +60,3 @@
/* adjust for button line-height being > 1 */
margin-top: -2px;
}

.buttonText {
overflow: hidden;
text-overflow: ellipsis;
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
import { Localized } from "@fluent/react/compat";
import cn from "classnames";
import { noop } from "lodash";
import React, { ComponentType, FunctionComponent } from "react";
import React, {
ComponentType,
FunctionComponent,
useCallback,
useEffect,
useRef,
} from "react";

import AutoLoadMore from "coral-admin/components/AutoLoadMore";
import { useToggleState } from "coral-framework/hooks";
import { IntersectionProvider } from "coral-framework/lib/intersection";
import {
ArrowsDownIcon,
ArrowsUpIcon,
ButtonSvgIcon,
} from "coral-ui/components/icons";
import {
Button,
ClickOutside,
Dropdown,
Flex,
Popover,
Spinner,
} from "coral-ui/components/v2";
import { TextArea } from "coral-ui/components/v3";

import styles from "./PaginatedSelect.css";

interface Props {
onLoadMore?: () => void;
onFilter?: (filter: string) => void;
label: string;
Icon?: ComponentType;
hasMore?: boolean;
disableLoadMore?: boolean;
Expand All @@ -33,21 +43,42 @@ interface Props {

const PaginatedSelect: FunctionComponent<Props> = ({
onLoadMore = noop,
onFilter,
disableLoadMore = false,
hasMore = false,
loading = false,
children,
Icon,
selected,
className,
label,
}) => {
const filterRef = useRef<HTMLTextAreaElement>(null);

const [isPopoverVisible, setIsPopoverVisible, togglePopoverVisible] =
useToggleState(false);

useEffect(() => {
if (isPopoverVisible && filterRef.current) {
filterRef.current.focus();
}
}, [isPopoverVisible]);

const handleButtonBlur = useCallback(() => {
if (!onFilter) {
return;
}
setIsPopoverVisible(false);
}, [onFilter, setIsPopoverVisible]);

return (
<Popover
id=""
placement="bottom-end"
modifiers={{ arrow: { enabled: false }, offset: { offset: "0, 4" } }}
body={({ toggleVisibility }) => (
<ClickOutside onClickOutside={toggleVisibility}>
<ClickOutside onClickOutside={() => setIsPopoverVisible(false)}>
<Popover
id=""
placement="bottom-end"
modifiers={{ arrow: { enabled: false }, offset: { offset: "0, 4" } }}
visible={isPopoverVisible}
body={
<IntersectionProvider>
<Dropdown className={styles.dropdown}>
{children}
Expand All @@ -66,42 +97,64 @@ const PaginatedSelect: FunctionComponent<Props> = ({
)}
</Dropdown>
</IntersectionProvider>
</ClickOutside>
)}
>
{({ toggleVisibility, ref, visible }) => (
<Button
className={cn(styles.button, className)}
variant="flat"
adornmentLeft
color="mono"
onClick={toggleVisibility}
ref={ref}
uppercase={false}
>
{Icon && (
<ButtonSvgIcon className={styles.buttonIconLeft} Icon={Icon} />
)}
<Flex alignItems="center" className={styles.wrapper}>
{selected}
}
>
{({ ref }) => (
<Flex
className={cn(styles.button, className)}
onClick={() => setIsPopoverVisible(true)}
ref={ref}
justifyContent="space-between"
aria-label={label}
>
{Icon && (
<ButtonSvgIcon className={styles.buttonIconLeft} Icon={Icon} />
)}
{isPopoverVisible && !!onFilter ? (
<Localized
id="admin-paginatedSelect-filter"
attrs={{ "aria-label": true }}
>
<TextArea
className={styles.filterInput}
onKeyDown={(e) => {
// We don't want blank lines to be added in input
if (e.key === "Enter") {
e.preventDefault();
}
}}
onChange={(e) => onFilter(e.target.value)}
ref={filterRef}
aria-label="Filter results"
/>
</Localized>
) : (
<Flex
alignItems="center"
aria-roledescription="button"
className={styles.wrapper}
tabIndex={0}
onFocus={() => setIsPopoverVisible(true)}
onBlur={handleButtonBlur}
>
{selected}
</Flex>
)}
{
<ButtonSvgIcon
className={styles.buttonIconRight}
Icon={isPopoverVisible ? ArrowsUpIcon : ArrowsDownIcon}
size="xs"
onClick={(e) => {
e.stopPropagation();
togglePopoverVisible();
}}
/>
}
</Flex>
{!visible && (
<ButtonSvgIcon
className={styles.buttonIconRight}
Icon={ArrowsDownIcon}
size="xs"
/>
)}
{visible && (
<ButtonSvgIcon
className={styles.buttonIconRight}
Icon={ArrowsUpIcon}
size="xs"
/>
)}
</Button>
)}
</Popover>
)}
</Popover>
</ClickOutside>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import EmailDomainConfigContainer from "./EmailDomainConfigContainer";
import ExternalLinksConfigContainer from "./ExternalLinksConfigContainer";
import NewCommentersConfigContainer from "./NewCommentersConfigContainer";
import PerspectiveConfig from "./PerspectiveConfig";
import PremoderateEmailAddressConfig from "./PremoderateEmailAddressConfig";
import PreModerationConfigContainer from "./PreModerationConfigContainer";
import RecentCommentHistoryConfig from "./RecentCommentHistoryConfig";

Expand Down Expand Up @@ -49,6 +50,7 @@ export const ModerationConfigContainer: React.FunctionComponent<Props> = ({
<NewCommentersConfigContainer disabled={submitting} settings={settings} />
<RecentCommentHistoryConfig disabled={submitting} />
<ExternalLinksConfigContainer disabled={submitting} settings={settings} />
<PremoderateEmailAddressConfig disabled={submitting} />
<EmailDomainConfigContainer settings={settings} />
</HorizontalGutter>
);
Expand All @@ -67,6 +69,7 @@ const enhanced = withFragmentContainer<Props>({
...EmailDomainConfigContainer_settings
...ExternalLinksConfigContainer_formValues @relay(mask: false)
...ExternalLinksConfigContainer_settings
...PremoderateEmailAddressConfig_formValues @relay(mask: false)
}
`,
})(ModerationConfigContainer);
Expand Down
Loading

0 comments on commit 096e601

Please sign in to comment.