Skip to content

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

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

// Hide the new question button from the hamburger menu's footer on desktop
.desktop-view .hamburger-panel .ai-new-question-button {
  display: none;
}

body.has-ai-conversations-sidebar {
  .sidebar-sections__back-to-forum {
    order: -1;
    padding: var(--space-6) var(--space-4) var(--space-3);

    + .ai-new-question-button__wrapper {
      margin-top: 0;
    }
  }

  .ai-new-question-button {
    width: 100%;

    &__wrapper {
      margin: var(--space-6) var(--space-4) 0;

      .mobile-view & {
        padding: 1em;
        position: sticky;
        top: 0;
        margin: -0.5em 0 0; // avoid shift when sticking
        z-index: 1;
      }
    }
  }

  // When the sidebar is empty, we want to hide the "Today" header
  // and only show the empty state component
  &.has-empty-ai-conversations-sidebar
    .sidebar-section[data-section-name="today"]
    .sidebar-section-header-wrapper {
    display: none;
  }

  // When the sidebar isn't empty, BUT "today" is empty, hide
  // the entire section
  &:not(.has-empty-ai-conversations-sidebar)
    .sidebar-section[data-section-name="today"]:has(
      .ai-bot-sidebar-empty-state
    ) {
    display: none;
  }

  .ai-conversation-sidebar__link {
    font-size: var(--font-down-1);
  }

  .sidebar-toggle-all-sections {
    display: none;
  }

  // "Powered by Discourse" is redundant chrome on the AI conversations surface
  .powered-by-discourse {
    display: none;
  }

  // topic elements
  #topic-footer-button-share-and-invite,
  body:not(.staff) #topic-footer-button-archive,
  #topic-footer-buttons .topic-notifications-button,
  .bookmark-menu-trigger,
  .more-topics__container,
  .private-message-glyph-wrapper,
  .topic-header-participants,
  .topic-above-footer-buttons-outlet,
  #topic-footer-buttons .topic-footer-main-buttons details {
    display: none;
  }

  .topic-timer-info {
    border: none;
  }

  .topic-owner .actions .create-flag {
    // why flag my own post
    display: none;
  }

  .container.posts {
    margin-bottom: 0;

    .topic-navigation.with-timeline {
      top: calc(var(--header-offset, 60px) + 5.5em);
    }

    .topic-navigation {
      .topic-notifications-button {
        display: none;
      }
    }
  }

  #topic-title {
    display: flex;

    .title-wrapper {
      width: 100%;
      max-width: 960px;
    }
  }

  #topic-footer-buttons {
    margin-top: 1em;
    width: 100%;
    max-width: 50.5em;

    .topic-footer-main-buttons {
      justify-content: flex-end;
    }
  }

  #topic-progress-wrapper.docked {
    display: none;
  }

  @include viewport.until(lg) {
    #topic-progress-wrapper,
    .topic-navigation.with-topic-progress {
      display: none;
    }
  }

  @include viewport.until(lg) {
    .archetype-private_message .topic-post:last-child {
      margin-bottom: 0;
    }
  }

  nav.post-controls .actions button {
    padding: 0.5em 0.65em;

    &.reply {
      .d-icon {
        margin-right: 0.45em;
      }
    }
  }
}

body.ai-bot-conversations-page {
  .ai-bot-conversations {
    --input-max-width: 46em;
    display: flex;
    flex-direction: column;
    height: calc(100dvh - var(--header-offset) - 5em);

    .agent-llm-selector {
      display: flex;
      gap: var(--space-4);
      justify-content: flex-start;

      @include viewport.until(sm) {
        gap: var(--space-8);
      }

      .select-kit-body {
        .select-kit-collection {
          max-height: 50vh;
          overflow-y: auto;
        }
      }

      &__selection-wrapper {
        display: flex;
        flex-direction: row;
        align-items: center;

        @include viewport.until(sm) {
          flex-direction: column;
          align-items: flex-start;
        }

        .select-kit-header-wrapper {
          font-size: var(--font-down-1);
          flex-direction: row-reverse;
        }

        .select-kit-header-wrapper .d-icon {
          margin-right: 0;
          margin-left: 0.25em;
        }

        label {
          color: var(--primary-700);
          font-size: var(--font-down-1);
          font-weight: 500;
          margin: 0;
        }

        .name {
          display: block;

          @include ellipsis;
        }
      }

      .btn {
        display: flex;
        justify-content: flex-start;
        background-color: transparent;
        font-weight: bold;

        @include viewport.until(sm) {
          padding: 0;
        }
      }

      .btn:hover,
      .btn:focus {
        background-color: transparent;
        color: var(--primary);
      }

      .btn:hover .d-icon,
      .btn:focus .d-icon {
        color: var(--primary);
      }
    }

    &__content-wrapper {
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
      align-items: center;
      justify-content: center;
      flex: 1 1 auto;
      gap: var(--space-4);

      .loading-container {
        display: contents;
      }
    }

    &__title {
      font-size: var(--font-up-5);
      font-weight: bold;
      text-align: center;
      margin-bottom: 0.25em;
      line-height: var(--line-height-medium);

      .d-icon-discobot {
        height: 1em;
        width: 1em;
        margin-right: 0.15em;
        vertical-align: -0.1em;
      }

      // optical centering for layout balance
      @media screen and (height >= 600px) {
        margin-top: -6em;
      }
    }

    &__input-container {
      width: 80%;
      max-width: var(--input-max-width);
      display: flex;
      flex-direction: column;
      gap: var(--space-2);

      @include viewport.until(sm) {
        width: 100%;
      }
    }

    &__input-wrapper {
      --input-min-height: 2.5em;
      display: flex;
      align-items: center;
      width: 100%;
      border: 1px solid var(--primary-low);
      border-radius: var(--d-input-border-radius);
      background-color: var(--d-input-bg-color);

      &:has(textarea[disabled]) {
        background: var(--d-input-bg-color--disabled);
      }

      &.--disabled {
        cursor: not-allowed;
        opacity: 0.6;

        textarea,
        .btn {
          pointer-events: none;
        }
      }

      &:focus-within {
        border-color: var(--tertiary);
      }

      #ai-bot-conversations-input {
        --scrollbarBg: transparent;
        --scrollbarThumbBg: var(--primary-low);
        --scrollbarWidth: 10px;
        box-sizing: border-box;
        flex-grow: 1;
        margin: 0;
        resize: none;
        max-height: 30vh;
        min-height: var(--input-min-height);
        border: none;
        padding-inline: 0;
        scrollbar-color: var(--scrollbarThumbBg) var(--scrollbarBg);
        scrollbar-width: thin;
        transition: scrollbar-color 0.25s ease-in-out;
        height: 100%;
        line-height: var(--line-height-large);

        &::-webkit-scrollbar-thumb {
          background-color: var(--scrollbarThumbBg);
          border-radius: calc(var(--scrollbarWidth) / 2);
          border: calc(var(--scrollbarWidth) / 4) solid var(--secondary);
        }

        &::-webkit-scrollbar-track {
          background-color: transparent;
        }

        &::-webkit-scrollbar {
          width: var(--scrollbarWidth);
        }

        &::-moz-scrollbar-thumb {
          background-color: var(--scrollbarThumbBg);
          border-radius: calc(var(--scrollbarWidth) / 2);
          border: calc(var(--scrollbarWidth) / 4) solid var(--secondary);
        }

        &::-moz-scrollbar-track {
          background-color: transparent;
        }

        &::-moz-scrollbar {
          width: var(--scrollbarWidth);
        }

        &:focus-visible {
          outline: none;
          border-color: var(--tertiary);
        }

        &:not(:placeholder-shown) + .ai-conversation-submit {
          will-change: scale;

          &:hover,
          &:focus-visible {
            transform: scale(1.2);
          }

          .d-icon {
            color: var(--tertiary);
          }
        }
      }
    }

    .ai-disclaimer {
      text-align: center;
      font-size: var(--font-down-1);
      color: var(--primary-700);
      margin: 0;

      @include viewport.from(sm) {
        width: 80%;
        max-width: var(--input-max-width);
      }
    }

    .sidebar-footer-wrapper {
      display: flex;

      button {
        display: none;
      }
    }

    .topic-footer-main-buttons {
      justify-content: flex-end;
    }

    .ai-bot-conversations__uploads-container {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      gap: 0.5em;

      @include viewport.from(sm) {
        width: 80%;
        max-width: var(--input-max-width);
      }
    }

    .ai-bot-upload {
      display: flex;
      align-items: center;
      border: 1px solid var(--primary-low);
      border-radius: 10em;
      padding-left: 0.75em;
      color: var(--primary-high);
      font-size: var(--font-down-2);

      &__progress {
        margin-left: 0.5em;
      }

      &:hover,
      &:focus-visible {
        .d-icon {
          color: var(--danger);
        }
      }
    }

    &.--preview #ai-bot-conversations-input {
      padding-inline-start: var(--space-3);
      border-radius: var(--d-input-border-radius) 0 0
        var(--d-input-border-radius);
    }
  }
}

body.has-ai-conversations-sidebar {
  // custom user card link
  .user-card-meta__profile-link {
    display: block;
    padding: 0.5em 0 0.25em;

    .d-icon {
      font-size: var(--font-down-1);
      margin-right: 0.15em;
    }
  }

  // hide extra buttons
  .timeline-container .topic-timeline .timeline-footer-controls {
    display: none;
  }

  .topic-map {
    .topic-map__views-trigger,
    .topic-map__likes-trigger,
    .summarization-button,
    &__private-message-map,
    .topic-map__users-list {
      display: none;
    }

    // The bottom topic map (participants + invite) is redundant on the AI
    // conversation page — the docked composer sits where it would render.
    &.--bottom {
      display: none;
    }

    &__stats {
      height: 100%;
      flex-wrap: nowrap;
      gap: 1em;
    }

    .ai-conversation__participants {
      display: flex;
      flex-wrap: wrap;
      gap: 0.5em 0.25em;
      align-items: center;

      .avatar {
        width: 2em;
        height: 2em;
      }

      .trigger-group-card {
        display: flex;
        align-items: center;
        border: 1px solid var(--primary-low);
        border-radius: var(--d-button-border-radius);
        padding: 0.25em 0.5em;
        font-size: var(--font-down-1);

        span {
          position: relative;
          top: -1px;
        }

        .d-icon {
          position: relative;
          top: 1px;
        }

        a {
          color: var(--primary-medium);
        }
      }

      .btn {
        font-size: var(--font-down-1);
        margin-right: 0.5em;
      }
    }
  }
}

[data-identifier="ai-credit-limit-tooltip"] {
  .fk-d-tooltip__inner-content {
    // ensures errors with links displays correctly
    display: block;
  }
}

.ai-bot-anonymous-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon title"
    "body body";
  align-items: center;
  gap: 0 var(--space-3);
  box-sizing: border-box;
  width: calc(100% - 2 * var(--space-4));
  margin: var(--space-4) var(--space-4) 0;
  padding: var(--space-4);
  border: 1px solid var(--tertiary-medium);
  background: rgb(var(--tertiary-rgb), 0.075);
  box-shadow: var(--shadow-card);
  border-radius: var(--d-border-radius-large);
  font: inherit;
  text-align: start;
  cursor: pointer;

  @include viewport.until(sm) {
    margin-bottom: var(--space-4);
    gap: var(--space-3);
  }

  &:hover,
  &:focus-visible {
    border-color: var(--tertiary);
    background: rgb(var(--tertiary-rgb), 0.15);
  }

  .sidebar-container & {
    flex-shrink: 0;
    width: calc(var(--d-sidebar-width) - 2 * var(--space-4));
    gap: var(--space-3);
  }

  .ai-bot-conversations & {
    grid-template-areas:
      "icon title"
      "icon body";
    width: 100%;
    max-width: var(--input-max-width);
    margin: 0;
    align-items: start;

    .ai-bot-anonymous-card__icon {
      margin-top: var(--space-1);
    }

    body.has-sidebar-page & {
      display: none;
    }
  }

  &__icon {
    grid-area: icon;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--tertiary);
    color: var(--secondary);
    width: 2rem;
    height: 2rem;
  }

  &__title {
    grid-area: title;
    font-weight: 700;
  }

  &__body {
    grid-area: body;
    color: var(--primary-high);
    font-size: var(--font-down-1);
  }
}

.user-navigation .user-nav__messages-ai-bot-chats {
  .d-icon.d-icon-discobot {
    font-size: var(--font-0);
  }
}