Skip to content
Closed

Dev #1138

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
13 changes: 0 additions & 13 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,6 @@
rel="stylesheet"
/>

<link rel="stylesheet" href="https://ui.contentstack.com/contentstack.min.css" />
<script
type="text/javascript"
src="https://ui.contentstack.com/bootstrap.min.js"
crossorigin="anonymous"
async
></script>
<script
type="text/javascript"
src="https://ui.contentstack.com/contentstack.min.js"
async
></script>

<style type="text/css">
.skip-to-main-content-link {
position: absolute;
Expand Down
20 changes: 20 additions & 0 deletions ui/package-lock.json

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

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"@types/react-redux": "^7.1.33",
"@vitejs/plugin-react-swc": "^4.2.3",
"axios": "^1.16.0",
"bootstrap": "^5.3.6",
"final-form": "^4.20.10",
"html-react-parser": "^4.2.9",
"jwt-decode": "^4.0.0",
Expand Down
6 changes: 6 additions & 0 deletions ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import AppLayout from './components/layout/AppLayout';
import { useNetworkCheck } from './components/NetworkProvider';

// Styles
// Grid + utility classes (d-flex, vh-100, row/col-*, spacing). These used to come from
// https://ui.contentstack.com/contentstack.min.css, which now returns 402. Kept above the
// venus import so venus's own px-scale classes (.mb-3, .ml-8 ...) keep winning.
import 'bootstrap/dist/css/bootstrap-grid.min.css';
import 'bootstrap/dist/css/bootstrap-utilities.min.css';
import './scss/legacy-cdn-shim.scss';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

question: The shim's cascade position isn't the same as the CDN <link>'s, and the comment above only reasons about venus.

The <link> lived in ui/index.html's <head>, ahead of every stylesheet Vite injects. This import sits partway through the bundle: the imports at App.tsx:7-13 (./store, ./components/Common/router, ErrorBoundary, AppLayout β†’ MainHeader/SideBar) execute first, so their .scss is emitted before this line. Relative order vs. venus is preserved β€” that part of the comment is correct β€” but relative order vs. component CSS is inverted: shim rules that used to lose to a component rule at equal specificity now win.

I went looking for a live collision and couldn't find one. The shim's global-ish selectors (a, .link, small, .small, .card h1-h6) only meet nested, higher-specificity rules in MainHeader/index.scss:40, RegionalLogin/index.scss:42 and App.scss:135, so nothing flips today. Hence a question, not a bug β€” but the ordering is load-bearing and one new top-level a {} or .link {} in a component stylesheet would silently break it.

Suggested fix: either note the constraint in the comment, or move these three imports into ui/src/index.tsx between import './index.css' (line 5) and import App from './App' (line 6), where they genuinely precede all component CSS and match the old <head> position.


Generated by Claude Code

import '@contentstack/venus-components/build/main.css';
import './scss/App.scss';

Expand Down
129 changes: 129 additions & 0 deletions ui/src/scss/legacy-cdn-shim.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// Rules recovered from https://ui.contentstack.com/contentstack.min.css, the stylesheet
// index.html used to load until that host was taken down (now HTTP 402, DEPLOYMENT_DISABLED).
// It was Bootstrap v5.1.3 plus Contentstack's brand layer; the grid/utility half is covered by
// the local `bootstrap` dependency, but these non-utility rules had no other source. Declarations

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

blocker: Bootstrap Reboot is a third thing the CDN file provided, and it has no replacement here.

The CDN served full Bootstrap 5.1.3 = Reboot + grid + utilities + components. This PR replaces it with bootstrap-grid.min.css + bootstrap-utilities.min.css, and neither contains a single bare-element rule β€” I checked both 5.3.6 dist files: zero button{}, input{}, select{}, textarea{}, svg{}. The two Reboot declarations that matter here:

button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}
img,svg{vertical-align:middle}

Nothing else supplies them:

  • venus main.css has no bare button / input / select / svg rule (only textarea{overflow:auto;resize:none}), and its Meyer-style reset element list excludes form controls and svg.
  • Every bare-element rule in ui/src/**/*.scss is nested inside a class, so none is global.

Failure scenario: ui/src/components/ContentMapper/index.tsx:3320,3355,3391 and entryMapper.tsx:539,573,609 render raw <button className="iconsholder list-button"> / className="list-button schema-preview". .list-button (ui/src/scss/App.scss:433) sets only background, border, width; .iconsholder and .schema-preview set no font either. Those buttons inherit Inter from html, body (App.scss:284-287) only because Reboot said font-family: inherit β€” browsers do not inherit font into form controls by default. After this change they fall back to the UA default (~400 13.3px Arial in Chrome), so the ContentMapper field list changes typeface and size. Same for the raw <input> at components/Modal/index.tsx:131 and the two SchemaModal buttons; inline <svg> additionally picks up baseline descender space without vertical-align: middle.

Suggested fix β€” append to this file. It loads before venus, exactly where the CDN <link> sat, so the original cascade is reproduced:

// Bootstrap Reboot: form controls don't inherit font by default, and the CDN's
// full-Bootstrap build was the only thing making them do so.
button,
input,
optgroup,
select,
textarea {
  margin: 0;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

img,
svg {
  vertical-align: middle;
}

Generated by Claude Code

// below are copied verbatim from an archived copy of that file, limited to classes this app
// actually uses.
//
// Load order matters: this must stay above the venus stylesheet, where the CDN <link> used to sit,
// so venus keeps winning the same conflicts it won before.

@import 'variables';

// Contentstack's spacing scale went past Bootstrap's 0-5.
.pt-6 {
padding-top: 4rem !important;
}

// The CDN scoped heading colour inside cards, which outranked the plain `h2` rule in App.scss
// (`color: $color-base-black-base`). Without it, card headings render pure black instead of
// Contentstack navy.
.card {
h1,
h2,
h3,
h4,
h5,
h6 {
color: $color-font-black;
}
}

// Bootstrap's button base, flattened to the values the CDN's brand layer ended up with
// (font-weight 600 and font-size 1rem override the 700/1.125rem in Bootstrap's own rule).
// Only one element uses it: the <Link className="btn primary-btn"> on the home page, which
// wraps a venus <Button>. It contributes nothing but padding around that button and is a
// reasonable thing to delete from Home separately - restored here so the fix stays visual-neutral.
.btn {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

question: .primary-btn isn't restored alongside .btn.

ui/src/pages/Home/index.tsx:46 is <Link to={...} className="btn primary-btn pb-0 mt-3">. This block brings .btn back, but .primary-btn has no definition in ui/src/**/*.scss, in venus main.css, or in Bootstrap 5.1.3 / 5.3.6 β€” so it came from the CDN's brand layer and is now a dead class. The host returns 402, so I can't recover what it declared.

If it supplied the purple background, note this block hands the element color: #fff with background-color: transparent, which is white-on-white for any text directly inside the <Link>. In practice the visible control is the nested venus <Button version="v2">, which carries its own colours, so I'd expect no visible change β€” but worth confirming against a before/after of Home. If it is genuinely dead, dropping primary-btn from the className (and then the .btn block along with it, as the comment above suggests) is cleaner than carrying a shim for it.


Generated by Claude Code

display: inline-block;
padding: 0.8125rem 2.1875rem;
font-family: inherit;
font-size: 1rem;
font-weight: 600;
line-height: 1;
color: #fff;
text-align: center;
text-decoration: none;
vertical-align: middle;
cursor: pointer;
user-select: none;
background-color: transparent;
border: 1px solid transparent;
border-radius: 0.5rem;

&:hover {
color: #fff;
}
}

// Global anchor colour. Without this, every link in the app falls back to the
// browser default (blue + underline) instead of Contentstack purple.
a,
.link {
text-decoration: none;
color: #7c4dff;
cursor: pointer;
}

a:hover,
a:focus,
.link:hover,
.link:focus {
color: #7c4dff;
text-decoration: underline;
}

// Typography helpers.
small,
.small {
font-size: 0.875em;
}

.body-4 {
font-size: 1rem;
font-weight: 400;
line-height: 1.375;
}

.body-6 {
font-size: 0.75rem;
font-weight: 400;
line-height: 1.3333333333;
}

// The trailing arrow that slides right on hover. The original pulled it from
// ui.contentstack.com/icons/default-link.svg; that asset is recovered here as an inline data URI
// (same approach as AutoVerticalStepper.scss) so nothing external is needed.
.link-basic-icon {
font-weight: 600;

&:hover {
text-decoration: none;
}

&::after {
content: '';
background: url('data:image/svg+xml,%3Csvg%20width%3D%2211%22%20height%3D%2211%22%20viewBox%3D%220%200%2011%2011%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10.7698%206.0549C11.0767%205.74796%2011.0767%205.2495%2010.7698%204.94256L6.84101%201.01377C6.53407%200.706835%206.0356%200.706835%205.72867%201.01377C5.42173%201.32071%205.42173%201.81917%205.72867%202.12611L8.31921%204.7142H0.785758C0.351136%204.7142%200%205.06534%200%205.49996C0%205.93458%200.351136%206.28572%200.785758%206.28572H8.31676L5.73112%208.87381C5.42419%209.18075%205.42419%209.67921%205.73112%209.98615C6.03806%2010.2931%206.53653%2010.2931%206.84346%209.98615L10.7723%206.05736L10.7698%206.0549Z%22%20fill%3D%22%237C4DFF%22%2F%3E%3C%2Fsvg%3E')
no-repeat;
width: 14px;
height: 14px;
position: relative;
left: 8px;
top: 2px;
padding-left: 15px;
}

&:hover::after {
left: 12px;
transition: all 0.4s ease;
}

&.link-arrow::after {
top: 4px;
}
}

.card .link-basic-icon,
.card .stretched-link {
font-weight: 600 !important;
}
Loading