Skip to content

🎨 fix: Terms and Conditions Modal Styling #4169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion client/src/components/Endpoints/SaveAsPresetDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const SaveAsPresetDialog = ({ open, onOpenChange, preset }: TEditPresetProps) =>
aria-label={localize('com_endpoint_preset_name')}
className={cn(
defaultTextProps,
'flex h-10 max-h-10 w-full resize-none border-gray-100 px-3 py-2 dark:border-gray-600',
'flex h-10 max-h-10 w-full resize-none border-border-medium px-3 py-2 ',
removeFocusOutlines,
)}
/>
Expand Down
29 changes: 17 additions & 12 deletions client/src/components/ui/TermsAndConditionsModal.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { useLocalize } from '~/hooks';
import { OGDialog } from '~/components/ui';
import MarkdownLite from '~/components/Chat/Messages/Content/MarkdownLite';
import DialogTemplate from '~/components/ui/DialogTemplate';
import { useAuthContext } from '~/hooks';
import Markdown from '~/components/Chat/Messages/Content/Markdown';
import { useToastContext } from '~/Providers';
import { useAcceptTermsMutation } from '~/data-provider';
import { useToastContext } from '~/Providers';
import { OGDialog } from '~/components/ui';
import { useLocalize } from '~/hooks';

const TermsAndConditionsModal = ({
open,
Expand Down Expand Up @@ -58,27 +57,33 @@ const TermsAndConditionsModal = ({
showCloseButton={false}
showCancelButton={false}
main={
<div className="max-h-[60vh] overflow-y-auto p-4">
<div className="prose dark:prose-invert w-full max-w-none !text-black dark:!text-white">
{modalContent ? (
<Markdown content={modalContent} isLatestMessage={false} />
<section
// Motivation: This is a dialog, so its content should be focusable
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
tabIndex={0}
className="max-h-[60vh] overflow-y-auto p-4"
aria-label={localize('com_ui_terms_and_conditions')}
>
<div className="prose dark:prose-invert w-full max-w-none !text-text-primary">
{modalContent != null && modalContent ? (
<MarkdownLite content={modalContent} />
) : (
<p>{localize('com_ui_no_terms_content')}</p>
)}
</div>
</div>
</section>
}
buttons={
<>
<button
onClick={handleDecline}
className="border-border-none bg-surface-500 dark:hover:bg-surface-600 inline-flex h-10 items-center justify-center rounded-lg px-4 py-2 text-sm text-white hover:bg-gray-600"
className="inline-flex h-10 items-center justify-center rounded-lg border border-border-heavy bg-surface-secondary px-4 py-2 text-sm text-text-primary hover:bg-surface-active"
>
{localize('com_ui_decline')}
</button>
<button
onClick={handleAccept}
className="border-border-none bg-surface-500 inline-flex h-10 items-center justify-center rounded-lg px-4 py-2 text-sm text-white hover:bg-green-600 dark:hover:bg-green-600"
className="inline-flex h-10 items-center justify-center rounded-lg border border-border-heavy bg-surface-secondary px-4 py-2 text-sm text-text-primary hover:bg-green-500 hover:text-white focus:bg-green-500 focus:text-white dark:hover:bg-green-600 dark:focus:bg-green-600"
>
{localize('com_ui_accept')}
</button>
Expand Down
6 changes: 3 additions & 3 deletions client/src/routes/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import TermsAndConditionsModal from '~/components/ui/TermsAndConditionsModal';
import { Banner } from '~/components/Banners';

export default function Root() {
const { isAuthenticated, logout, token } = useAuthContext();
const { isAuthenticated, logout } = useAuthContext();
const navigate = useNavigate();
const [navVisible, setNavVisible] = useState(() => {
const savedNavVisible = localStorage.getItem('navVisible');
Expand All @@ -27,7 +27,7 @@ export default function Root() {
const [showTerms, setShowTerms] = useState(false);
const { data: config } = useGetStartupConfig();
const { data: termsData } = useUserTermsQuery({
enabled: isAuthenticated && !!config?.interface?.termsOfService?.modalAcceptance,
enabled: isAuthenticated && config?.interface?.termsOfService?.modalAcceptance === true,
});

useEffect(() => {
Expand Down Expand Up @@ -66,7 +66,7 @@ export default function Root() {
</div>
</div>
</AgentsMapContext.Provider>
{config?.interface?.termsOfService?.modalAcceptance && (
{config?.interface?.termsOfService?.modalAcceptance === true && (
<TermsAndConditionsModal
open={showTerms}
onOpenChange={setShowTerms}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/data-provider/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "librechat-data-provider",
"version": "0.7.423",
"version": "0.7.424",
"description": "data services for librechat apps",
"main": "dist/index.js",
"module": "dist/index.es.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/data-provider/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ export type TInterfaceConfig = {
openNewTab?: boolean;
modalAcceptance?: boolean;
modalTitle?: string;
modalContent?: string | string[];
modalContent?: string;
};
endpointsMenu: boolean;
modelSelect: boolean;
Expand Down