Skip to content
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

🎉 Homepage redesign #3219

Merged
merged 46 commits into from
Feb 22, 2024
Merged

🎉 Homepage redesign #3219

merged 46 commits into from
Feb 22, 2024

Conversation

ikesau
Copy link
Member

@ikesau ikesau commented Feb 19, 2024

Figma

Test document

There's a big change in bundle size because the new homepage-search component moves the algolia library into common.mjs

The FrontPage code is all still in here (with a few modifications where I overrode/reused/shared CSS) but will be removed once this branch is merged and we've published the new homepage.

New Features

  • A new homepage gdoc type
    • It's basically a body of new, homepage-specific components and then some static content appended beneath
    • If a published homepage exists, it will be baked as index.html, otherwise we bake the default frontpage.
  • A new homepageMetadata attachments context (to provide stats on how many charts and topics we have)

New components

  • pill-row
  • homepage-search
  • homepage-intro
  • latest-data-insights

TODO

  • Design fixes
  • Accordion for all our topics list

Summary by CodeRabbit

  • New Features
    • Introduced support for the Homepage document type across the platform, including icons, settings, and preview functionalities.
    • Added new homepage-specific content blocks such as PillRow, HomepageIntro, HomepageSearch, and LatestDataInsightsBlock.
    • Implemented a new layout and components for displaying the latest data insights on the homepage.
    • Enhanced search functionality with additional props for customization and improved user interaction.
  • Style
    • Updated styles across various components and pages, including color adjustments and grid layout changes to support new homepage elements.
    • Introduced new SCSS files for styling latest data insights and homepage-specific components.
  • Documentation
    • Added structured data for Google search actions on the SearchPage.
  • Refactor
    • Centralized database operations related to data insights into the db module.
    • Refined the handling and rendering logic for various content types, including the homepage and data insights.
  • Chores
    • Updated imports and variable names to reflect changes in content structure and types.

🎉  Homepage Search archie component
Copy link

coderabbitai bot commented Feb 19, 2024

Walkthrough

The updates encompass a holistic approach to support homepage content management and display throughout the project. These changes include expanding file size limits, introducing new content types like the Homepage document, and refining data insights handling. Furthermore, enhancements in styling and component rendering logic have been implemented to facilitate dynamic homepage elements and streamline content management processes.

Changes

File(s) Summary
adminSiteClient/.../GdocsBreadcrumbsInput.tsx
site/DataInsightsIndexPageContent.tsx
site/SiteHeader.tsx
Updated imports and variables related to data insights. Renamed variables for semantic consistency and added new properties for homepage rendering.
db/model/Gdoc/enrichedToMarkdown.ts
db/model/Gdoc/rawToEnriched.ts
site/gdocs/OwidGdocPage.tsx
Added functionality and logic for various block types including latest-data-insights, pill-row, homepage-search, and homepage-intro.
site/SiteNavigation.tsx
site/css/homepage.scss
Introduced new imports, variables, and styles for homepage navigation and layout adjustments. Added conditional rendering based on content type.
site/gdocs/components/ExplorerTiles.scss
site/gdocs/components/ExplorerTiles.tsx
Updated styles and text content for explorer tiles component. Adjusted background color and font size for better visual presentation.
site/gdocs/components/HomepageIntro.scss
site/gdocs/components/HomepageIntro.tsx
site/gdocs/components/HomepageSearch.tsx
Added styling and components for the homepage introduction section, featured work tiles, and search bar with autocomplete functionality.
site/gdocs/components/KeyIndicatorCollection.scss
site/gdocs/components/KeyIndicatorCollection.tsx
Updated styling for key indicator collection component including margin properties and small screen styles. Utilized AttachmentsContext for metadata access.
site/gdocs/components/LatestDataInsights.scss
site/gdocs/components/LatestDataInsights.tsx
Introduced styling rules and a new React component for displaying the latest data insights with titles and publication dates.
site/gdocs/components/centered-article.scss
site/gdocs/pages/DataInsight.tsx
Updated styling for specific classes and renamed constants for clarity and consistency in data insight mapping.
site/gdocs/pages/Homepage.tsx
site/search/Autocomplete.tsx
site/search/SearchPage.tsx
site/search/SearchPanel.tsx
Introduced components for homepage layout, enhanced autocomplete functionality, and added structured data for Google search.
.bundlewatch.config.json
adminSiteClient/gdocsDeploy.ts
baker/SiteBaker.tsx
Adjusted file size limits, integrated homepage settings, and improved data insights retrieval and homepage rendering processes.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@ikesau ikesau requested a review from mlbrgl February 19, 2024 23:43
site/SiteNavigation.tsx Outdated Show resolved Hide resolved
Comment on lines 990 to 1027
.article-block__pill-row {
background-color: $blue-20;
scrollbar-width: thin;
overflow-x: auto;
.article-block__pill-row-interior {
display: flex;
padding: 8px 0;
}
p {
color: $blue-60;
margin: 0 9px 0 0;
line-height: 32px;
white-space: nowrap;
}
ul {
list-style: none;
display: flex;
flex-wrap: nowrap;
}
.article-block__pill {
&:not(:last-child) {
margin-right: 8px;
}
a {
color: $blue-100;
background-color: #fff;
line-height: 2rem;
padding: 0 16px;
display: inline-block;
transition: background-color 250ms;
border-radius: 32px;
white-space: nowrap;
&:hover {
background-color: $gray-10;
}
}
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The styling for .article-block__pill-row is well-structured and follows SCSS best practices. However, consider using variables for repeated values such as margin sizes and colors to enhance maintainability and consistency across the stylesheet.

-        margin: 0 9px 0 0;
+        margin: 0 $pill-row-margin-right 0 0; // Assuming $pill-row-margin-right: 9px; is defined at the top
-            background-color: #fff;
+            background-color: $white; // Assuming $white: #fff; is defined at the top
-                background-color: $gray-10;
+                background-color: $pill-hover-bg-color; // Assuming $pill-hover-bg-color: $gray-10; is defined at the top

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
.article-block__pill-row {
background-color: $blue-20;
scrollbar-width: thin;
overflow-x: auto;
.article-block__pill-row-interior {
display: flex;
padding: 8px 0;
}
p {
color: $blue-60;
margin: 0 9px 0 0;
line-height: 32px;
white-space: nowrap;
}
ul {
list-style: none;
display: flex;
flex-wrap: nowrap;
}
.article-block__pill {
&:not(:last-child) {
margin-right: 8px;
}
a {
color: $blue-100;
background-color: #fff;
line-height: 2rem;
padding: 0 16px;
display: inline-block;
transition: background-color 250ms;
border-radius: 32px;
white-space: nowrap;
&:hover {
background-color: $gray-10;
}
}
}
}
.article-block__pill-row {
background-color: $blue-20;
scrollbar-width: thin;
overflow-x: auto;
.article-block__pill-row-interior {
display: flex;
padding: 8px 0;
}
p {
color: $blue-60;
margin: 0 $pill-row-margin-right 0 0; // Assuming $pill-row-margin-right: 9px; is defined at the top
line-height: 32px;
white-space: nowrap;
}
ul {
list-style: none;
display: flex;
flex-wrap: nowrap;
}
.article-block__pill {
&:not(:last-child) {
margin-right: 8px;
}
a {
color: $blue-100;
background-color: $white; // Assuming $white: #fff; is defined at the top
line-height: 2rem;
padding: 0 16px;
display: inline-block;
transition: background-color 250ms;
border-radius: 32px;
white-space: nowrap;
&:hover {
background-color: $pill-hover-bg-color; // Assuming $pill-hover-bg-color: $gray-10; is defined at the top
}
}
}
}

Comment on lines 246 to 261
// This function is temporarily forked until we have fully transitioned to a gdocs homepage,
// whereupon we'll strip out the old front page code.
export const renderFrontPage = async () => {
// Annoying, MySQL+TypeORM doesn't support JSONB, so I'm using raw SQL to confirm if there's a published homepage
const gdocHomepageResult = await db.knexRawFirst<{ id: string }>(
`SELECT id FROM posts_gdocs WHERE content->>"$.type" = "${OwidGdocType.Homepage}" AND published = TRUE`,
db.knexInstance()
)

if (gdocHomepageResult) {
const gdocHomepage = await GdocFactory.load(gdocHomepageResult.id)
if (gdocHomepage) {
await gdocHomepage.loadState()
return renderGdoc(gdocHomepage)
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modifications to the renderFrontPage function introduce a new approach to rendering the homepage by checking for a published homepage Google Doc before proceeding with the existing logic. This change is significant as it affects the initial content users will see. Consider the following points:

  1. SQL Injection Protection: The SQL query within db.knexRawFirst uses parameterized inputs, which is a good practice for preventing SQL injection vulnerabilities. However, since this is a critical security aspect, double-check that all dynamic inputs to SQL queries throughout the application follow this practice.
  2. Error Handling: Ensure that there is adequate error handling around the database query and subsequent logic. If the database query fails or if there are issues loading the Google Doc, the application should handle these gracefully, possibly falling back to the default rendering logic.
  3. Performance Considerations: Depending on the frequency of homepage visits, this database query could potentially impact performance. Consider caching the result of the homepage check or the rendered homepage content itself to reduce database load.
  4. Maintainability: The comment mentions that this function is temporarily forked and will undergo further changes. Ensure that there is a clear plan and timeline for the transition to the new homepage rendering logic to avoid having temporary fixes become permanent technical debt.

Overall, the approach seems sound, but careful attention should be paid to security, error handling, and performance implications.

Consider implementing caching for the homepage check or rendered content to improve performance. Additionally, ensure robust error handling around the database query and Google Doc loading process.

Comment on lines 2073 to 2120
function parsePillRow(raw: RawBlockPillRow): EnrichedBlockPillRow {
function createError(error: ParseError): EnrichedBlockPillRow {
return {
type: "pill-row",
parseErrors: [error],
pills: [],
title: "",
}
}

if (!raw.value.title) {
return createError({
message: "Pill row is missing a title",
})
}
if (!raw.value.pills) {
return createError({
message: "Pill row is missing pills",
})
}

const pills: { text: string; url: string }[] = []

for (const rawPill of raw.value.pills) {
const url = extractUrl(rawPill.url)
if (!url) {
return createError({
message: "A pill is missing a url",
})
}

if (!rawPill.text && getLinkType(url) !== "gdoc") {
return createError({
message:
"A pill that is linking to a non-gdoc resource is missing text",
})
}

pills.push({ text: rawPill.text!, url })
}

return {
type: "pill-row",
parseErrors: [],
pills: pills,
title: raw.value.title,
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parsePillRow function correctly parses the pill-row block type from raw to enriched format. However, there's a potential improvement in error handling and validation:

  • Consider validating the url format to ensure it's a valid URL.
  • It might be beneficial to validate the presence of text for each pill, even if it links to a gdoc, to ensure consistency and clarity in the UI.
for (const rawPill of raw.value.pills) {
    const url = extractUrl(rawPill.url)
    if (!url) {
        return createError({
            message: "A pill is missing a url",
        })
    }
+   // Validate URL format
+   if (!isValidUrl(url)) {
+       return createError({
+           message: `The URL "${url}" is not valid.`,
+       })
+   }
    if (!rawPill.text && getLinkType(url) !== "gdoc") {
        return createError({
            message:
                "A pill that is linking to a non-gdoc resource is missing text",
        })
    }
    pills.push({ text: rawPill.text!, url })
}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
function parsePillRow(raw: RawBlockPillRow): EnrichedBlockPillRow {
function createError(error: ParseError): EnrichedBlockPillRow {
return {
type: "pill-row",
parseErrors: [error],
pills: [],
title: "",
}
}
if (!raw.value.title) {
return createError({
message: "Pill row is missing a title",
})
}
if (!raw.value.pills) {
return createError({
message: "Pill row is missing pills",
})
}
const pills: { text: string; url: string }[] = []
for (const rawPill of raw.value.pills) {
const url = extractUrl(rawPill.url)
if (!url) {
return createError({
message: "A pill is missing a url",
})
}
if (!rawPill.text && getLinkType(url) !== "gdoc") {
return createError({
message:
"A pill that is linking to a non-gdoc resource is missing text",
})
}
pills.push({ text: rawPill.text!, url })
}
return {
type: "pill-row",
parseErrors: [],
pills: pills,
title: raw.value.title,
}
}
function parsePillRow(raw: RawBlockPillRow): EnrichedBlockPillRow {
function createError(error: ParseError): EnrichedBlockPillRow {
return {
type: "pill-row",
parseErrors: [error],
pills: [],
title: "",
}
}
if (!raw.value.title) {
return createError({
message: "Pill row is missing a title",
})
}
if (!raw.value.pills) {
return createError({
message: "Pill row is missing pills",
})
}
const pills: { text: string; url: string }[] = []
for (const rawPill of raw.value.pills) {
const url = extractUrl(rawPill.url)
if (!url) {
return createError({
message: "A pill is missing a url",
})
}
// Validate URL format
if (!isValidUrl(url)) {
return createError({
message: `The URL "${url}" is not valid.`,
})
}
if (!rawPill.text && getLinkType(url) !== "gdoc") {
return createError({
message:
"A pill that is linking to a non-gdoc resource is missing text",
})
}
pills.push({ text: rawPill.text!, url })
}
return {
type: "pill-row",
parseErrors: [],
pills: pills,
title: raw.value.title,
}
}

Comment on lines +750 to +759
export type RawBlockPillRow = {
type: "pill-row"
value: {
title?: string
pills?: {
text?: string
url?: string
}[]
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RawBlockPillRow type definition correctly specifies optional properties for title and pills, which aligns with the flexible nature of content blocks. However, consider adding a comment to clarify the use case for when text might be optional within pills.

Comment on lines +675 to +682
.with({ type: "homepage-intro" }, (block) => {
return (
<HomepageIntro
className={getLayout("homepage-intro")}
{...block}
/>
)
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rendering logic for the HomepageIntro component is well-implemented, with the component's props being correctly spread and the className being determined using the getLayout function. However, it seems that the containerType prop is not passed to getLayout for this component, which could lead to inconsistent styling if different container types are intended to affect its layout. Consider passing containerType to ensure consistent styling across different usage contexts.

- <HomepageIntro className={getLayout("homepage-intro")} {...block} />
+ <HomepageIntro className={getLayout("homepage-intro", containerType)} {...block} />

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
.with({ type: "homepage-intro" }, (block) => {
return (
<HomepageIntro
className={getLayout("homepage-intro")}
{...block}
/>
)
})
.with({ type: "homepage-intro" }, (block) => {
return (
<HomepageIntro
className={getLayout("homepage-intro", containerType)}
{...block}
/>
)
})

Comment on lines +259 to +269
export const getTotalNumberOfTopics = (): Promise<number> => {
return knexRawFirst<{ count: number }>(
`
SELECT COUNT(DISTINCT(tagId)) AS count
FROM chart_tags
WHERE chartId IN (
SELECT id
FROM charts
WHERE publishedAt IS NOT NULL)`,
knexInstance()
).then((res) => res?.count ?? 0)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getTotalNumberOfTopics function correctly counts the number of unique topics by counting distinct tagId values from chart_tags where the chart is published. It follows best practices for query parameterization. Similar to other functions, adding error handling would enhance its reliability.

export const getTotalNumberOfTopics = (): Promise<number> => {
    return knexRawFirst<{ count: number }>(
        `SELECT COUNT(DISTINCT(tagId)) AS count
        FROM chart_tags
        WHERE chartId IN (
        SELECT id
        FROM charts
        WHERE publishedAt IS NOT NULL)`,
        knexInstance()
    ).then((res) => res?.count ?? 0)
+   .catch((error) => {
+       console.error("Failed to get total number of topics:", error);
+       throw error; // Rethrow or handle as appropriate for your application
+   });
}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
export const getTotalNumberOfTopics = (): Promise<number> => {
return knexRawFirst<{ count: number }>(
`
SELECT COUNT(DISTINCT(tagId)) AS count
FROM chart_tags
WHERE chartId IN (
SELECT id
FROM charts
WHERE publishedAt IS NOT NULL)`,
knexInstance()
).then((res) => res?.count ?? 0)
export const getTotalNumberOfTopics = (): Promise<number> => {
return knexRawFirst<{ count: number }>(
`SELECT COUNT(DISTINCT(tagId)) AS count
FROM chart_tags
WHERE chartId IN (
SELECT id
FROM charts
WHERE publishedAt IS NOT NULL)`,
knexInstance()
).then((res) => res?.count ?? 0)
.catch((error) => {
console.error("Failed to get total number of topics:", error);
throw error; // Rethrow or handle as appropriate for your application
});
}

site/gdocs/pages/Homepage.tsx Outdated Show resolved Hide resolved
Comment on lines +6 to +30
function Pill(props: { text?: string; url: string }) {
const { linkedDocument, errorMessage } = useLinkedDocument(props.url)
const { isPreviewing } = useContext(DocumentContext)
const url = linkedDocument ? `/${linkedDocument.slug}` : props.url
const text = props.text ?? linkedDocument?.title

if (isPreviewing) {
if (errorMessage || !text || !url) {
return (
<li className="article-block__pill article-block__pill--error">
{errorMessage}
</li>
)
}
}

if (!text || !url) return null

return (
<li className="article-block__pill">
<a className="body-3-medium" href={url}>
{text}
</a>
</li>
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Pill component and PillRow function are well-implemented with clear logic for handling linked documents and previewing states. However, consider adding error handling for the useLinkedDocument hook to gracefully handle any potential failures in fetching linked documents.

Consider implementing error handling within the useLinkedDocument hook to improve resilience and user experience.

Comment on lines +33 to +53
_validateSubclass = async (): Promise<OwidGdocErrorMessage[]> => {
const errors: OwidGdocErrorMessage[] = []
const otherPublishedHomepages = await db.knexRaw<{ id: string }>(
`
SELECT
id
FROM posts_gdocs
WHERE content->>"$.type" = "${OwidGdocType.Homepage}"
AND published = TRUE
AND id != ?`,
db.knexInstance(),
[this.id]
)
if (otherPublishedHomepages.length > 0) {
errors.push({
property: "published",
message: `There can only be one published homepage. There is a homepage with the ID ${otherPublishedHomepages[0].id} that is already published.`,
type: OwidGdocErrorMessageType.Error,
})
}
return errors
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validation logic to ensure only one homepage is published at a time is crucial for maintaining site integrity. However, consider optimizing the SQL query to improve performance, especially if the posts_gdocs table grows significantly.

Optimize the SQL query in _validateSubclass for better performance with large datasets.

Copy link
Member

@mlbrgl mlbrgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(commit of in-progress review comments)

@@ -0,0 +1,200 @@
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome/index.js"

This saves 10KB on the bundle when replacing all occurrences of "import { FontAwesomeIcon } from @fortawesome/react-fontawesome across the codebase.

bundlewatch: before, after

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Good to know!

db/model/Gdoc/GdocHomepage.ts Show resolved Hide resolved
site/gdocs/pages/Homepage.tsx Outdated Show resolved Hide resolved
.bundlewatch.config.json Outdated Show resolved Hide resolved
site/gdocs/components/HomepageIntro.tsx Outdated Show resolved Hide resolved
Copy link
Member

@mlbrgl mlbrgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's really nice to see how the gdoc architecture scales to this special use case - to the point where it is not that special any more, and we barely needed a template for it.

I also like how you thoroughly handle edge cases and error reporting 👍

site/gdocs/components/LatestDataInsights.tsx Outdated Show resolved Hide resolved
@@ -61,7 +61,7 @@ $grid-responsive: (lg, md, sm);
// Use this when you want a full-page-width grid container
// 1 (auto) | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 (auto)
.grid-cols-12-full-width {
--outer-column-width: calc((50vw - 640px - var(--grid-gap)));
--outer-column-width: calc((50vw - 647.5px - var(--grid-gap)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain me this change in a few words?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually can't 😭

I have no idea why it's happening but it seems like every couple of months this rule stops working and the 12-column grid is no longer 1280px wide.

load the homepage and look at .latest-data-insights-block__card-container on a desktop - it's 1280px

then change --outer-column-width to what is was before and the element's 1265px wide

but last time I did this I swear it was too large so I bumped it back down. 😭😭

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting I'm seeing different widths on Chrome:

  • 647.5 -> 1295px
  • 640 -> 1280px

site/SiteNavigation.tsx Outdated Show resolved Hide resolved
site/search/Autocomplete.scss Outdated Show resolved Hide resolved
site/search/SearchPage.tsx Show resolved Hide resolved
ORDER BY publishedAt DESC
LIMIT ?
`,
knexInstance(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with the recent refactor in #3194, you're now able to get the knex instance from the baker directly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure I understand you - you mean all these db functions should take knex as an argument and we pass the same instance around everywhere? 🙂

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep 😉

SELECT
content->>'$.title' AS title,
publishedAt,
ROW_NUMBER() OVER (ORDER BY publishedAt DESC) - 1 AS \`index\`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems a bit heavy handed, given that we can get the index in the map() below (EDIT: I'm seeing now this has been merely moved so not really part of this PR)

db/model/Gdoc/rawToEnriched.ts Outdated Show resolved Hide resolved
db/model/Gdoc/enrichedToMarkdown.ts Outdated Show resolved Hide resolved
@ikesau ikesau removed the coderabbit label Feb 21, 2024
@ikesau ikesau merged commit 3380f9c into master Feb 22, 2024
16 of 17 checks passed
@ikesau ikesau deleted the homepage-feature-branch branch February 22, 2024 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants