Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Apr 16, 2024
2 parents f91163b + beb13fa commit 3146d1f
Show file tree
Hide file tree
Showing 10 changed files with 349 additions and 323 deletions.
2 changes: 1 addition & 1 deletion client/src/curriculum/modules-list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@
font-size: var(--type-smaller-font-size);
height: 11rem;
justify-content: space-between;
padding: 1rem var(--spacing);
padding: var(--spacing);

p {
color: var(--text-secondary);
Expand Down
24 changes: 23 additions & 1 deletion client/src/document/organisms/sidebar/filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ import { Button } from "../../../ui/atoms/button";

import "./filter.scss";
import { useGleanClick } from "../../../telemetry/glean-context";
import { SIDEBAR_FILTER_FOCUS } from "../../../telemetry/constants";
import {
SIDEBAR_FILTER_FOCUS,
SIDEBAR_FILTER_TYPED,
} from "../../../telemetry/constants";

export function SidebarFilter() {
const [isActive, setActive] = useState<Boolean>(false);
const [hasTyped, setTyped] = useState<Boolean>(false);
const { query, setQuery, matchCount } = useSidebarFilter();
const gleanClick = useGleanClick();

Expand All @@ -17,6 +21,24 @@ export function SidebarFilter() {
}
}, [gleanClick, isActive]);

useEffect(() => {
if (query) {
setTyped(true);
}
}, [query, setTyped]);

useEffect(() => {
if (hasTyped) {
gleanClick(SIDEBAR_FILTER_TYPED);
}
}, [gleanClick, hasTyped]);

useEffect(() => {
if (!isActive) {
setTyped(false);
}
}, [isActive, setTyped]);

return (
<section className="sidebar-filter-container">
<div className={`sidebar-filter ${query ? "has-input" : ""}`}>
Expand Down
7 changes: 6 additions & 1 deletion client/src/plus/ai-help/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,9 @@ function ReportIssueOnGitHubLink({
currentMessage: Message;
children: React.ReactNode;
}) {
const user = useUserData();
const isSubscriber = useMemo(() => isPlusSubscriber(user), [user]);

const gleanClick = useGleanClick();
const currentMessageIndex = messages.indexOf(currentMessage);
const questions = messages
Expand All @@ -1105,8 +1108,10 @@ function ReportIssueOnGitHubLink({
(source) =>
`- [${source.title}](https://developer.mozilla.org${source.url})`
)
.join("\n") ?? "(None)"
.join("\n") || "(None)"
);
// TODO Persist model in messages and read it from there.
sp.set("model", isSubscriber ? "gpt-4" : "gpt-3.5");
sp.set("template", "ai-help-answer.yml");

url.search = sp.toString();
Expand Down
1 change: 1 addition & 0 deletions client/src/telemetry/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const OFFER_OVERVIEW_CLICK = "offer_overview_click";
export const SIDEBAR_CLICK = "sidebar_click";
export const SIDEBAR_CLICK_WITH_FILTER = "sidebar_click_with_filter";
export const SIDEBAR_FILTER_FOCUS = "sidebar_filter_focus";
export const SIDEBAR_FILTER_TYPED = "sidebar_filter_typed";
export const TOC_CLICK = "toc_click";
/** Replaced "top_nav_already_subscriber" in July 2023. */
export const TOP_NAV_LOGIN = "top_nav: login";
Expand Down
68 changes: 34 additions & 34 deletions deployer/poetry.lock

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

4 changes: 2 additions & 2 deletions deployer/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ readme = "README.md"
[tool.poetry.dependencies]
python = "^3.10"
click = "^8.1.7"
boto3 = "^1.34.79"
boto3 = "^1.34.84"
python-decouple = "^3.8"
requests = {extras = ["security"], version = "^2.31.0"}
elasticsearch-dsl = "^7.4.1"
Expand All @@ -19,7 +19,7 @@ PyGithub = "^1.59"
unidiff = "^0.7.5"

[tool.poetry.dev-dependencies]
black = "^24.3"
black = "^24.4"
flake8 = "^7.0.0"
pytest = "^8.1.1"

Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,20 @@
"dependencies": {
"@caporal/core": "^2.0.7",
"@codemirror/lang-css": "^6.2.1",
"@codemirror/lang-html": "^6.4.8",
"@codemirror/lang-html": "^6.4.9",
"@codemirror/lang-javascript": "^6.2.2",
"@codemirror/state": "^6.4.1",
"@codemirror/theme-one-dark": "^6.1.2",
"@fast-csv/parse": "^5.0.0",
"@mdn/bcd-utils-api": "^0.0.7",
"@mdn/browser-compat-data": "^5.5.20",
"@mdn/browser-compat-data": "^5.5.21",
"@mozilla/glean": "4.0.0",
"@sentry/integrations": "^7.109.0",
"@sentry/node": "^7.109.0",
"@sentry/integrations": "^7.110.1",
"@sentry/node": "^7.110.1",
"@stripe/stripe-js": "^3.3.0",
"@use-it/interval": "^1.0.0",
"@vscode/ripgrep": "^1.15.9",
"@webref/css": "^6.12.6",
"@webref/css": "^6.12.7",
"accept-language-parser": "^1.5.0",
"async": "^3.2.5",
"chalk": "^5.3.0",
Expand All @@ -94,7 +94,7 @@
"dayjs": "^1.11.10",
"dexie": "^3.2.7",
"dotenv": "^16.4.5",
"ejs": "^3.1.9",
"ejs": "^3.1.10",
"express": "^4.19.2",
"fdir": "^6.1.1",
"feed": "^4.2.2",
Expand All @@ -110,7 +110,7 @@
"imagemin-mozjpeg": "^10.0.0",
"imagemin-pngquant": "^9.0.2",
"imagemin-svgo": "^10.0.1",
"inquirer": "^9.2.17",
"inquirer": "^9.2.18",
"is-svg": "^5.0.0",
"js-yaml": "^4.1.0",
"loglevel": "^1.9.1",
Expand All @@ -121,7 +121,7 @@
"mdn-data": "^2.5.0",
"open": "^10.1.0",
"open-editor": "^4.1.1",
"openai": "^4.33.0",
"openai": "^4.35.0",
"pg": "^8.11.5",
"pgvector": "^0.1.8",
"prism-svelte": "^0.5.0",
Expand Down Expand Up @@ -157,19 +157,19 @@
"@babel/preset-env": "^7.24.4",
"@mdn/dinocons": "^0.5.5",
"@mdn/minimalist": "^2.0.4",
"@playwright/test": "^1.43.0",
"@playwright/test": "^1.43.1",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@svgr/webpack": "^8.1.0",
"@swc/core": "^1.4.13",
"@swc/core": "^1.4.14",
"@testing-library/react": "^14.3.0",
"@types/async": "^3.2.24",
"@types/cli-progress": "^3.11.5",
"@types/imagemin": "^8.0.5",
"@types/jest": "^29.5.12",
"@types/mdast": "^4.0.3",
"@types/node": "^18.16.6",
"@types/react": "^18.2.75",
"@types/react-dom": "^18.2.24",
"@types/react": "^18.2.79",
"@types/react-dom": "^18.2.25",
"@types/react-modal": "^3.16.3",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
Expand All @@ -192,7 +192,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^28.2.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-n": "^17.2.0",
"eslint-plugin-n": "^17.2.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unicorn": "^52.0.0",
Expand Down Expand Up @@ -221,9 +221,9 @@
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-loader": "^8.1.1",
"postcss-normalize": "^10.0.1",
"postcss-preset-env": "^9.5.4",
"postcss-preset-env": "^9.5.5",
"prettier": "^3.2.5",
"prettier-plugin-packagejson": "^2.4.14",
"prettier-plugin-packagejson": "^2.5.0",
"prompts": "^2.4.2",
"react": "^18.2.0",
"react-app-polyfill": "^3.0.0",
Expand All @@ -237,8 +237,8 @@
"resolve": "^1.22.8",
"resolve-url-loader": "^5.0.0",
"rough-notation": "^0.5.1",
"sass": "^1.74.1",
"sass-loader": "^14.1.1",
"sass": "^1.75.0",
"sass-loader": "^14.2.0",
"semver": "^7.6.0",
"source-map-explorer": "^2.5.3",
"source-map-loader": "^5.0.0",
Expand All @@ -258,7 +258,7 @@
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.6.0",
"typescript-eslint": "^7.7.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4",
Expand Down
Loading

0 comments on commit 3146d1f

Please sign in to comment.