Skip to content

Commit

Permalink
Feature/subscription sortings (#493)
Browse files Browse the repository at this point in the history
  • Loading branch information
EduardZaydler authored Apr 3, 2024
1 parent 539b748 commit 6a62903
Show file tree
Hide file tree
Showing 31 changed files with 266 additions and 76 deletions.
20 changes: 20 additions & 0 deletions local_modules/styles/mixins.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,23 @@
max-width: @containerMaxWidth;
box-sizing: border-box;
}

.base-reset {
margin: 0;
padding: 0;
border: none;
background: none;
font: inherit;
-webkit-appearance: none;
appearance: none;
}

.italic-font {
color: @colorGrey;
font-style: italic;
}

.sorting-button {
&:extend(.italic-font, .base-reset);
cursor: pointer;
}
1 change: 1 addition & 0 deletions local_modules/styles/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
@containerMaxWidth: 1200px;
@containerGap: 15px;
@breakpoint: 600px;
@colorGrey: #666;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/Components/EventList/EventList.less
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
}

.header {
color: #666;
color: @colorGrey;
font-style: italic;
}

Expand Down Expand Up @@ -44,7 +44,7 @@
.curr-value {
width: 70px;
font-size: 12px;
color: #666;
color: @colorGrey;
}

.prev-value {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Footer/Footer.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
padding-top: 40px;
padding-bottom: 40px;
background-color: #efefef;
color: #666;
color: @colorGrey;
}

.container {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/MetricList/MetricList.less
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
padding: 0;
border: none;
background: none;
color: #666;
color: @colorGrey;
font: inherit;
font-style: italic;
-webkit-appearance: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.no-result {
padding: 30px;
color: #666;
color: @colorGrey;
text-align: center;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@
}

}

.empty-triggers {
padding: 30;
color: @colorGrey;
text-align: center;
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export default class MobileTriggerListPage extends React.Component<MobileTrigger
</MobileHeader>
<div className={cn("content")}>
{triggers != null && triggers.length === 0 && (
<div style={{ padding: 30, color: "#666", textAlign: "center" }}>
No results :-(
</div>
<div className={cn("empty-triggers")}>No results :-(</div>
)}
{triggers != null &&
triggers.map((trigger) => (
Expand Down
2 changes: 2 additions & 0 deletions src/Components/Mobile/Styles/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@
@no-data-color: noDataColor;

@primary-divider-color: #ddd;

@colorGrey: #666;
7 changes: 1 addition & 6 deletions src/Components/NotificationList/NotificationList.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@
margin-top: 5px;
}

.header {
color: #666;
font-style: italic;
}

.timestamp {
width: 15%;
}
Expand Down Expand Up @@ -61,6 +56,6 @@
}

.no-result {
color: #666;
color: @colorGrey;
text-align: center;
}
2 changes: 1 addition & 1 deletion src/Components/NotificationList/NotificationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function NotificationList(props: Props): React.ReactElement {
<>
{ConfirmModal}
<Gapped gap={30} vertical>
<div className={cn("row", "header")}>
<div className={cn("row", "italic-font")}>
<div className={cn("timestamp")}>Timestamp</div>
<div className={cn("state")}>State</div>
<div className={cn("trigger")}>Trigger</div>
Expand Down
24 changes: 2 additions & 22 deletions src/Components/PatternList/PatternList.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,12 @@
}
}

.header {
color: #666;
font-style: italic;
}

.name {
width: calc(~'100% - 240px');

&.clicked {
margin: 0;
padding: 0;
border: none;
background: none;
color: inherit;
font: inherit;
&:extend(.base-reset);
text-align: left;
-webkit-appearance: none;
appearance: none;
cursor: pointer;
}
}
Expand All @@ -49,15 +37,7 @@
.metric-counter,
.control {
width: 80px;
margin: 0;
padding: 0;
border: none;
background: none;
color: #666;
font: inherit;
font-style: italic;
-webkit-appearance: none;
appearance: none;
&:extend(.sorting-button);
}

.info {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/PatternList/PatternList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function PatternList(props: Props): React.ReactElement {
const sortingIcon = sortingDown ? <ArrowBoldDownIcon /> : <ArrowBoldUpIcon />;
return (
<div>
<div className={cn("row", "header")}>
<div className={cn("row", "header", "italic-font")}>
<div className={cn("name")}>Pattern</div>
<button
type="button"
Expand Down
4 changes: 3 additions & 1 deletion src/Components/ResourceIDBadge/ResourceIDBadge.less
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@import '~styles/variables.less';

.wrapper {
margin: 0 0 16px;
}

.title {
color: #666;
color: @colorGrey;
margin-bottom: 4px
}

Expand Down
4 changes: 3 additions & 1 deletion src/Components/SubscriptionEditor/SubscriptionEditor.less
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '~styles/variables.less';

.form {
.row {
margin-bottom: 15px;
Expand All @@ -7,7 +9,7 @@
}

.caption {
color: #666;
color: @colorGrey;
margin-bottom: 5px;
}

Expand Down
23 changes: 23 additions & 0 deletions src/Components/SubscriptionList/SubscriptionList.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,31 @@
@import '~styles/variables.less';
@import '~styles/mixins.less';

.items-container {
margin: 0 -10px;
}

.items {
border-collapse: collapse;
width: 100%;
}

.header {
&:extend(.italic-font);
margin-bottom: 5px;
border-bottom: 1px solid #eee;

td {
padding: 5px;
}
}

.fold-button-gap {
display: none;
}

@media screen and (max-width: @breakpoint) {
.fold-button-gap {
display: table-cell;
}
}
33 changes: 31 additions & 2 deletions src/Components/SubscriptionList/SubscriptionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React from "react";
import { Contact } from "../../Domain/Contact";
import { Subscription } from "../../Domain/Subscription";
import { SubscriptionRow } from "./SubscriptionRow/SubscriptionRow";

import ArrowBoldDownIcon from "@skbkontur/react-icons/ArrowBoldDown";
import ArrowBoldUpIcon from "@skbkontur/react-icons/ArrowBoldUp";
import { useSortData } from "../../hooks/useSortData";
import classNames from "classnames/bind";

import styles from "./SubscriptionList.less";
Expand All @@ -22,11 +24,38 @@ export const SubscriptionList: React.FC<Props> = ({
contacts,
handleEditSubscription,
}) => {
const { sortedData, sortConfig, handleSort } = useSortData(subscriptions, "contacts");

const SortingIcon =
sortConfig.direction === "descending" ? <ArrowBoldDownIcon /> : <ArrowBoldUpIcon />;
return (
<div className={cn("items-container")}>
<table ref={tableRef} className={cn("items")}>
<thead>
<tr className={cn("header")}>
<td className={cn("fold-button-gap")} />
<td colSpan={2}>
<button
onClick={() => handleSort("tags")}
type="button"
className={cn("sorting-button")}
>
Tags {sortConfig.sortingColumn === "tags" && SortingIcon}
</button>
</td>
<td>
<button
onClick={() => handleSort("contacts")}
type="button"
className={cn("sorting-button")}
>
Contacts {sortConfig.sortingColumn === "contacts" && SortingIcon}
</button>
</td>
</tr>
</thead>
<tbody>
{subscriptions.map((subscription) => (
{sortedData.map((subscription) => (
<SubscriptionRow
key={subscription.id}
subscription={subscription}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Tag/Tag.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
height: 20px;
border-radius: 2px;
background-color: #eee;
color: #666;
color: @colorGrey;
text-overflow: ellipsis;
white-space: nowrap;
vertical-align: top;
Expand Down
12 changes: 1 addition & 11 deletions src/Components/TagList/TagList.less
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}

.header {
color: #666;
color: @colorGrey;
font-style: italic;
margin-bottom: 5px;
}
Expand Down Expand Up @@ -75,13 +75,3 @@
.sub-control {
width: 100px;
}

.sorting-button {
margin: 0;
padding: 0;
border: none;
background: none;
color: #666;
font: inherit;
cursor: pointer;
}
2 changes: 1 addition & 1 deletion src/Components/TriggerInfo/TriggerInfo.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
font-style: italic;
margin-top: 10px;
width: 150px;
color: #666;
color: @colorGrey;
}

dd {
Expand Down
2 changes: 1 addition & 1 deletion src/Components/TriggerList/TriggerList.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@import '~styles/mixins.less';

.no-result {
color: #666;
color: @colorGrey;
text-align: center;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Components/TriggerListItem/TriggerListItem.less
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
}

.NA {
color: #666666;
color: @colorGrey;
}

.data {
Expand Down
Loading

0 comments on commit 6a62903

Please sign in to comment.