Skip to content

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

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

.composer-ai-helper-modal {
  .inline-diff {
    font-family: var(--d-font-family--monospace);
    font-variant-ligatures: none;
  }

  .text-preview,
  .inline-diff {
    ins {
      background-color: var(--success-low);
      text-decoration: none;
    }

    del {
      background-color: var(--danger-low);
      text-decoration: line-through;
    }

    mark {
      background-color: var(--highlight-low);
      border-bottom: 2px solid var(--highlight-high);

      ins,
      del {
        background: transparent;
        text-decoration: none;
      }
    }

    .same-word {
      color: var(--primary);
    }

    .ghost {
      color: var(--primary-low-mid);
    }

    .preview-area {
      height: 200px;
    }
  }

  @keyframes fadeOpacity {
    0% {
      opacity: 1;
    }

    100% {
      opacity: 0.5;
    }
  }

  &__loading {
    animation: fadeOpacity 1.5s infinite alternate;
  }

  &__old-value {
    white-space: pre-wrap;
    border-left: 2px solid var(--danger);
    padding-left: 1rem;
    color: var(--danger);
    margin-bottom: 1rem;
  }

  &__new-value {
    border-left: 2px solid var(--success);
    padding-left: 1rem;
    color: var(--success);
  }

  .d-modal__footer {
    .regenerate {
      margin-left: auto;
    }
  }
}

.topic-above-suggested-outlet.related-topics {
  margin: 4.5em 0 1em;
}

.ai-composer-helper-menu {
  max-width: 25rem;
  list-style: none;

  ul {
    margin: 0;
    list-style: none;
  }
}

.ai-custom-prompt {
  display: flex;
  gap: 0.25rem;
  padding: 0.75em 1rem;

  &__input[type="text"] {
    border-color: var(--primary-400);
    margin-bottom: 0;

    &::placeholder {
      color: var(--primary-medium);
    }
  }
}

.ai-helper-loading {
  display: flex;
  padding: 0.5rem;
  gap: 1rem;
  justify-content: flex-start;
  align-items: center;

  .dot-falling {
    margin-inline: 1rem;
    margin-left: 1.5rem;
  }
}

.d-editor-input.loading {
  animation: loading-text 1.5s infinite linear;
}

@keyframes loading-text {
  0% {
    color: var(--primary);
  }

  50% {
    color: var(--tertiary);
  }

  100% {
    color: var(--primary);
  }
}

.ai-helper-highlighted-selection {
  background-color: var(--highlight-low-or-medium);
}

// AI Typing indicator (taken from: https://github.com/nzbin/three-dots)
.dot-falling {
  position: relative;
  left: -9999px;
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: var(--tertiary);
  color: var(--tertiary);
  box-shadow: 9999px 0 0 0 var(--tertiary);
  animation: dot-falling 1s infinite linear;
  animation-delay: 0.1s;
}

.dot-falling::before,
.dot-falling::after {
  content: "";
  display: inline-block;
  position: absolute;
  top: 0;
}

.dot-falling::before {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: var(--tertiary);
  color: var(--tertiary);
  animation: dot-falling-before 1s infinite linear;
  animation-delay: 0s;
}

.dot-falling::after {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background-color: var(--tertiary);
  color: var(--tertiary);
  animation: dot-falling-after 1s infinite linear;
  animation-delay: 0.2s;
}

@keyframes dot-falling {
  0% {
    box-shadow: 9999px -15px 0 0 rgb(152, 128, 255, 0);
  }

  25%,
  50%,
  75% {
    box-shadow: 9999px 0 0 0 var(--tertiary);
  }

  100% {
    box-shadow: 9999px 15px 0 0 rgb(152, 128, 255, 0);
  }
}

@keyframes dot-falling-before {
  0% {
    box-shadow: 9984px -15px 0 0 rgb(152, 128, 255, 0);
  }

  25%,
  50%,
  75% {
    box-shadow: 9984px 0 0 0 var(--tertiary);
  }

  100% {
    box-shadow: 9984px 15px 0 0 rgb(152, 128, 255, 0);
  }
}

@keyframes dot-falling-after {
  0% {
    box-shadow: 10014px -15px 0 0 rgb(152, 128, 255, 0);
  }

  25%,
  50%,
  75% {
    box-shadow: 10014px 0 0 0 var(--tertiary);
  }

  100% {
    box-shadow: 10014px 15px 0 0 rgb(152, 128, 255, 0);
  }
}

// Suggest Titles Related
.showing-ai-suggestions {
  #edit-title {
    padding-right: 2em;
  }
}

.suggestion-button,
.ai-split-topic-suggestion-button {
  .d-icon-spinner {
    animation: spin 1s linear infinite;
  }
}

.edit-title__wrapper,
.edit-category__wrapper,
.edit-tags__wrapper {
  position: relative;
}

.suggest-titles-button {
  position: absolute;

  .edit-topic-title & {
    background: var(--primary-low);
    right: var(--space-1);
    bottom: 50%;
    border-radius: var(--d-input-border-radius); // to match surrounding input
    padding: 0.4em;
    font-size: var(--font-down-1-rem);
    z-index: z("composer", "dropdown");
    transform: translateY(50%);

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

#reply-control {
  .composer-actions.is-expanded,
  .composer-popup {
    // need to raise the z-index here
    // because we need another layer to put the AI icon above dropdowns
    // while also keeping them below the composer tips
    z-index: z("composer", "dropdown") + 2;
  }
}

.ai-suggestions-menu .btn {
  text-align: left;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(359deg);
  }
}

.ai-post-helper {
  &__suggestion {
    display: flex;
    flex-direction: column;

    h2 {
      font-size: var(--font-0);
      border-bottom: 1px solid var(--primary-low);
      padding-bottom: 0.5em;
    }

    p {
      margin: 0;
    }

    &__copy {
      .d-icon-check {
        color: var(--success);
      }
    }

    &__text {
      padding: 0.5rem;
    }

    &__buttons {
      display: flex;
      align-items: center;
      gap: 0.5rem;

      .btn {
        flex-grow: 1;
        padding-inline: 0;
      }
    }
  }

  &__fast-edit {
    .fast-edit-container {
      padding: 0.75em 1rem;
    }
  }
}

.choose-topic-modal .split-new-topic-form {
  .control-group {
    display: flex;
    flex-flow: row wrap;
    align-items: center;
    gap: 0.25em;
    margin-bottom: 1rem;

    label {
      flex: 100%;
    }

    input,
    .combo-box,
    .multi-select {
      flex: 1;
      margin-bottom: 0;
    }
  }
}

.ai-split-topic-suggestion__results {
  list-style: none;
  margin: 0;

  .btn {
    display: block;
    width: 100%;
    text-align: left;
    background: none;

    &:hover,
    &:focus {
      background: var(--d-hover);
      color: var(--primary);
    }
  }

  li:not(:last-child) {
    border-bottom: 1px solid var(--primary-low);
  }

  .ai-split-topic-suggestion__category-result {
    font-size: var(--font-0);
    padding: 0.5em 1rem;

    &:hover,
    &:focus {
      background: var(--d-hover);
      cursor: pointer;
    }
  }

  .topic-count {
    font-size: var(--font-down-2);
    color: var(--primary-high);
  }
}

.fk-d-menu[data-identifier="ai-split-topic-suggestion-menu"] {
  z-index: z("modal", "dropdown");
}

.ai-split-topic-loading-placeholder {
  .d-icon-spinner {
    animation: spin 1s linear infinite;
  }

  + .ai-split-topic-suggestion-button {
    display: none;
  }
}

.thumbnail-suggestions-modal {
  .ai-thumbnail-suggestions {
    display: flex;
    flex-flow: row wrap;
    position: relative;
    gap: 0.5em;

    &__item {
      flex: 35%;
      position: relative;
    }

    img {
      width: 100%;
      height: auto;
    }

    .btn {
      position: absolute;
      top: 0.5rem;
      left: 0.5rem;
    }
  }

  .regenerate {
    margin-left: auto;
  }
}

.ai-post-image-caption-editor {
  display: contents;

  &__button.btn-transparent {
    color: var(--tertiary);
    min-height: 0;
    padding: 0;
  }
}

.ai-post-image-caption-editor-modal {
  &__textarea {
    min-height: 7em;
  }
}

// AI Helper Options List
.ai-helper-options {
  margin: 0;
  list-style: none;

  li {
    display: flex;
    align-items: center;

    .shortcut {
      margin-left: auto;
    }
  }

  &__button {
    justify-content: left;
    text-align: left;
    background: none;
    width: 100%;
    border-radius: 0;
    margin: 0;
    padding: 0.7rem 1rem;

    &:focus,
    &:hover {
      color: var(--primary);
      background: var(--d-hover);

      .discourse-no-touch & {
        color: var(--primary);
        background: var(--d-hover);
      }

      .d-icon {
        color: var(--primary-high);

        .discourse-no-touch & {
          color: var(--primary-high);
        }
      }
    }
  }
}

.fk-d-menu,
.fk-d-menu-modal {
  &[data-identifier="ai-composer-helper-menu"],
  &[data-identifier="ai-title-suggester"] {
    z-index: z("modal", "dialog");

    .fullscreen-composer & {
      z-index: z("header") + 1;
    }

    .ai-suggestions-menu {
      max-width: 100%;

      &__loading {
        text-align: center;
        padding: var(--space-2);

        .d-icon-spinner {
          animation: spin 1s linear infinite;
        }
      }

      &__empty {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        padding: var(--space-1) var(--space-2) var(--space-1) var(--space-4);
      }

      &__empty-text {
        font-size: var(--font-down-1-rem);
      }

      .d-button-label {
        @include ellipsis;
      }
    }
  }
}

.fk-d-toasts:has(.ai-proofread-error-toast) {
  top: unset;
  bottom: calc(var(--composer-height) - 5%);
  right: unset;
  left: 0;
}

@media screen and (min-width: $reply-area-max-width) {
  .has-sidebar-page {
    .fk-d-toasts:has(.ai-proofread-error-toast) {
      transform: translateX(
        calc(
          (100vw - var(--d-max-width) - var(--d-sidebar-width) / 0.5) / 2 +
            17em + 1rem
        )
      );
    }
  }
}

// new inline AI helper
.select-kit.mini-tag-chooser .select-kit-row,
.select-kit.category-chooser .select-kit-row {
  &.ai-category-suggest-row,
  &.ai-tag-suggest-row,
  &.ai-tag-exit-row {
    position: sticky;
    top: 0;
    z-index: z("dropdown") + 1;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-1);
    font-size: var(--font-down-1-rem);
    border-bottom: 1px solid var(--primary-low);
    background: var(--secondary);

    .name {
      margin: 0;
      font-size: var(--font-0); // unset
    }

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

  &.ai-tag-exit-row {
    font-weight: bold;
  }

  &.ai-category-suggest-row,
  &.ai-tag-suggest-row {
    color: var(--primary-medium);
    font-style: italic;

    .d-icon-spinner {
      animation: spin 1s linear infinite;
    }
  }
}

.select-kit.category-chooser.is-loading:not(.is-expanded) {
  .select-kit-header .angle-icon {
    display: none;
  }

  .select-kit-header-wrapper::after {
    content: "";
    align-self: center;
    margin-left: auto;
    width: 0.9em;
    height: 0.9em;
    border: 2px solid var(--primary-low-mid);
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
}