Skip to content

A platform for community discussion. Free, open, simple.

5.8 KB
Raw Blame
@use "lib/viewport";

// Styles for /admin/users
.display-row.associations .value {
  width: 750px;

  @media (max-width: $mobile-breakpoint) {
    width: 75%;
    float: right;
    text-align: left;
    margin-left: 0;
  }
}

.display-row {
  display: flex;
  align-items: center;
  padding: 10px 5px;
  border-top: 1px solid var(--content-border-color);

  &:nth-of-type(1) {
    border-top: 0;
  }

  &.highlight-danger {
    background-color: var(--danger-low);
  }

  &::before,
  &::after {
    display: table;
    content: "";
  }

  &::after {
    clear: both;
  }

  &.secondary-emails ul {
    margin: 0;
    list-style: none;
  }

  .field {
    font-weight: bold;
    width: 17.65765%;
    min-width: 125px;
    margin-left: 12px;

    @media (max-width: $mobile-breakpoint) {
      margin-left: 0;
      line-height: var(--line-height-large);
      margin-top: 5px;
    }
  }

  .value {
    width: 100%;
    max-width: 350px;
    min-width: 50px;
    margin-left: 12px;
    word-break: break-word;

    @media (max-width: $mobile-breakpoint) {
      text-align: left;
      margin-left: 0;
    }

    .select-kit {
      min-width: 100px;
      width: inherit;
    }
  }

  .long-value {
    margin-left: 12px;
    font-size: var(--font-down-1);

    button {
      margin-left: 10px;
    }
  }

  .controls {
    margin-left: 12px;

    @media (max-width: $mobile-breakpoint) {
      width: 75%;
      text-align: left;
      margin-left: 0;
    }

    .btn {
      margin-right: 5px;
    }
  }

  &.silence-info .controls {
    display: flex;
    margin-left: 0;

    .full-reason {
      margin-left: 0.3em;
    }
  }

  &.username,
  &.name {
    .value {
      word-break: break-all;
    }
  }
}

.admin-users {
  input {
    margin-bottom: 0;
  }

  .users-list {
    .username .d-icon {
      color: var(--primary-medium);
    }
  }
}

.admin-users-list {
  &__source,
  &__source-header {
    justify-content: start;
    text-align: start;
  }

  // Matches the cell padding so the heading lines up with the sources below.
  &__source-header.directory-table__column-header {
    padding-inline: 0.25em;
  }

  // Long usernames truncate instead of widening the column past its header.
  &__username {
    @include ellipsis;
    flex: 1 1 auto;
    min-width: 0;
    contain: inline-size;
  }

  &__source-values {
    min-width: 0;
    max-width: 28ch;
  }

  &__source-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
  }

  &__source-label {
    @include ellipsis;
    min-width: 0;
  }

  &__source-user {
    display: flex;
    align-items: center;
    gap: var(--space-2);

    // Outranks the list's general avatar margin; the gap spaces it instead.
    img.avatar {
      margin: 0;
    }
  }

  // Same breakpoint as the directory table's stacked layout.
  @container (max-width: 47em) {
    &__source .directory-table__label {
      flex-basis: 30%;
    }

    &__source-values {
      max-width: 70%;
    }
  }

  .directory-table__cell {
    padding: 0.5em 0.25em;

    &.username {
      align-items: center;
      justify-content: start;
      min-width: 0;

      .avatar {
        flex-shrink: 0;
      }
    }

    &.email {
      justify-content: start;

      @include viewport.until(md) {
        grid-column-start: 1;
        grid-column-end: -1;

        span {
          max-width: 100%;
        }
      }

      span {
        display: flex;
        min-width: 17em;
        word-break: break-all;
      }
    }
  }

  .directory-table {
    margin-top: 1em;

    &__column-header {
      &--username,
      &---email,
      &--silence-reason,
      &--suspend-reason {
        .header-contents {
          text-align: left;
        }
      }

      &--username {
        flex-grow: 1;
      }
    }

    &__column-header-wrapper {
      display: flex;
      border-bottom: 1px solid var(--table-border-color);

      // The wrapper's border runs under the bulk-select buttons too.
      .directory-table__column-header {
        border-bottom: none;
      }
    }

    &__cell-bulk-select {
      margin-right: 1em;
    }

    &__cell.silence_reason,
    &__cell.suspend_reason {
      text-align: left;
      justify-content: start;

      span {
        max-width: 12em;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }

  .user-status span {
    gap: 0.15em;
  }

  .avatar {
    margin-right: 0.25em;
  }
}

// mobile styles
.mobile-view .admin-users.admin-user {
  .display-row {
    flex-direction: column;
    align-items: flex-start;

    .field,
    .value {
      width: 100%;
    }

    .select-kit {
      width: 100%;
    }
  }

  .long-value {
    overflow-wrap: break-word;
    max-width: 100%;
    margin: 0;

    button {
      margin: 5px 0;
      display: block;
    }
  }

  h1 {
    margin: 15px 0 5px 0;
  }

  .user-controls {
    text-align: inherit;
  }

  .controls {
    width: unset;
    margin-top: 5px;
  }

  .associations button {
    margin: 5px 5px 0 0;
  }
}

.admin-user__danger-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: 100%;
  gap: var(--space-2);
}

.admin-bot-form {
  .form-kit__field-toggle {
    display: grid;
    grid-template-areas:
      "title content"
      "description description";
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 0.5em;
    width: 100%;

    @include viewport.from(sm) {
      width: var(--form-kit-large-input);
    }

    .form-kit__container-title,
    .form-kit__container-description,
    .form-kit__container-content {
      width: auto;
    }

    .form-kit__container-title {
      grid-area: title;
    }

    .form-kit__container-description {
      grid-area: description;
    }

    .form-kit__container-content {
      grid-area: content;
    }
  }
}

.select-kit.admin-users__subheader-new-bot .select-kit-body {
  min-width: auto;
  max-width: 22em;
}