Bläddra i källkod

Merge pull request #17008 from overleaf/jpa-jdt-wf-consent-init

 [web] new copy for Writefull promotion

GitOrigin-RevId: 4e67414a5f9ef96649d36e15a2aa8661ee4fdd59
Jakob Ackermann 2 år sedan
förälder
incheckning
cdca83d94e

+ 1 - 0
services/web/frontend/extracted-translations.json

@@ -1513,6 +1513,7 @@
   "writefull_loading_error_body": "",
   "writefull_loading_error_title": "",
   "writefull_prompt_body": "",
+  "writefull_prompt_terms": "",
   "writefull_prompt_title": "",
   "writefull_settings_description": "",
   "x_changes_in": "",

+ 5 - 0
services/web/frontend/js/shared/components/notification.tsx

@@ -16,6 +16,7 @@ export type NotificationProps = {
   className?: string
   content: React.ReactElement | string
   customIcon?: React.ReactElement
+  disclaimer?: React.ReactElement | string
   isDismissible?: boolean
   isActionBelowContent?: boolean
   onDismiss?: () => void
@@ -53,6 +54,7 @@ function Notification({
   className = '',
   content,
   customIcon,
+  disclaimer,
   isActionBelowContent,
   isDismissible,
   onDismiss,
@@ -99,6 +101,9 @@ function Notification({
           {content}
         </div>
         {action && <div className="notification-cta">{action}</div>}
+        {disclaimer && (
+          <div className="notification-disclaimer">{disclaimer}</div>
+        )}
       </div>
 
       {isDismissible && (

+ 6 - 3
services/web/frontend/js/shared/context/editor-context.tsx

@@ -19,6 +19,8 @@ import { useUserContext } from './user-context'
 import { saveProjectSettings } from '@/features/editor-left-menu/utils/api'
 import { PermissionsLevel } from '@/features/ide-react/types/permissions'
 
+type writefullAdButtons = '' | 'try-it' | 'log-in'
+
 export const EditorContext = createContext<
   | {
       cobranding?: {
@@ -46,8 +48,8 @@ export const EditorContext = createContext<
       inactiveTutorials: [string]
       currentPopup: string | null
       setCurrentPopup: Dispatch<SetStateAction<string | null>>
-      writefullAdClicked: boolean
-      setWritefullAdClicked: Dispatch<SetStateAction<boolean>>
+      writefullAdClicked: writefullAdButtons
+      setWritefullAdClicked: Dispatch<SetStateAction<writefullAdButtons>>
     }
   | undefined
 >(undefined)
@@ -86,7 +88,8 @@ export const EditorProvider: FC = ({ children }) => {
     getMeta('ol-inactiveTutorials', [])
   )
 
-  const [writefullAdClicked, setWritefullAdClicked] = useState(false)
+  const [writefullAdClicked, setWritefullAdClicked] =
+    useState<writefullAdButtons>('')
 
   const [currentPopup, setCurrentPopup] = useState<string | null>(null)
 

+ 4 - 0
services/web/frontend/stylesheets/components/notifications.less

@@ -96,6 +96,10 @@
     }
   }
 
+  .notification-disclaimer {
+    padding-bottom: 16px;
+  }
+
   .notification-close-btn {
     height: 56px;
     align-items: center;

+ 1 - 0
services/web/locales/en.json

@@ -2175,6 +2175,7 @@
   "writefull_loading_error_body": "Try refreshing the page. If this doesn’t work, try disabling any active browser extensions to check they aren’t blocking Writefull from loading.",
   "writefull_loading_error_title": "Writefull didn’t load correctly",
   "writefull_prompt_body": "Turn on the new Writefull integration to get free AI-powered language feedback specifically tailored to research writing.",
+  "writefull_prompt_terms": "[COPY NOT FINAL] By trying Writefull you agree to their <0>terms of service</0> and <1>privacy policy</1>. If you already have a Writefull account, you can <2>log in</2> to it. If not, we’ll create one for you as <3>__email__</3>.",
   "writefull_prompt_title": "AI writing assistance in Overleaf",
   "writefull_settings_description": "Get free AI-based language feedback specifically tailored for research writing with Writefull for Overleaf.",
   "x_changes_in": "__count__ change in",