2023-08-24 20:49:24 -04:00
|
|
|
import Component from "@glimmer/component";
|
|
|
|
import { action } from "@ember/object";
|
2023-11-03 07:30:09 -04:00
|
|
|
import { htmlSafe } from "@ember/template";
|
2023-08-24 20:49:24 -04:00
|
|
|
import DButton from "discourse/components/d-button";
|
|
|
|
import DModal from "discourse/components/d-modal";
|
2024-01-12 18:28:06 -05:00
|
|
|
import i18n from "discourse-common/helpers/i18n";
|
2023-08-24 20:49:24 -04:00
|
|
|
|
|
|
|
export default class ModalDiffModal extends Component {
|
2023-11-03 07:30:09 -04:00
|
|
|
@action
|
|
|
|
triggerConfirmChanges() {
|
|
|
|
this.args.closeModal();
|
|
|
|
this.args.confirm();
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
|
|
|
triggerRevertChanges() {
|
|
|
|
this.args.closeModal();
|
|
|
|
this.args.revert();
|
|
|
|
}
|
|
|
|
|
2023-08-24 20:49:24 -04:00
|
|
|
<template>
|
|
|
|
<DModal
|
|
|
|
class="composer-ai-helper-modal"
|
2024-01-12 18:28:06 -05:00
|
|
|
@title={{i18n "discourse_ai.ai_helper.context_menu.changes"}}
|
2023-08-24 20:49:24 -04:00
|
|
|
@closeModal={{@closeModal}}
|
|
|
|
>
|
|
|
|
<:body>
|
|
|
|
{{#if @diff}}
|
|
|
|
{{htmlSafe @diff}}
|
|
|
|
{{else}}
|
|
|
|
<div class="composer-ai-helper-modal__old-value">
|
|
|
|
{{@oldValue}}
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="composer-ai-helper-modal__new-value">
|
|
|
|
{{@newValue}}
|
|
|
|
</div>
|
|
|
|
{{/if}}
|
|
|
|
</:body>
|
|
|
|
|
|
|
|
<:footer>
|
|
|
|
<DButton
|
|
|
|
class="btn-primary confirm"
|
|
|
|
@action={{this.triggerConfirmChanges}}
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.confirm"
|
|
|
|
/>
|
2023-10-06 18:17:21 -04:00
|
|
|
<DButton
|
|
|
|
class="btn-flat"
|
|
|
|
@action={{this.triggerRevertChanges}}
|
|
|
|
@label="discourse_ai.ai_helper.context_menu.revert"
|
|
|
|
/>
|
2023-08-24 20:49:24 -04:00
|
|
|
</:footer>
|
|
|
|
</DModal>
|
|
|
|
</template>
|
|
|
|
}
|