diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index f6a185fbaa1..00000000000 --- a/.eslintrc +++ /dev/null @@ -1,20 +0,0 @@ -{ - "parser": "babel-eslint", - "extends": ["standard", "standard-react", "prettier"], - "env": { - "browser": true, - "jest": true, - "mocha": true, - "node": true - }, - "rules": { - "camelcase": 0, - "no-mixed-operators": 0, - "no-new": 0, - "react/jsx-indent": 0, - "react/prop-types": 0 - }, - "globals": { - "cy": true - } -} diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000000..0a272defaba --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,112 @@ +const path = require("path") + +module.exports = { + parser: "@typescript-eslint/parser", + + plugins: [ + "react-hooks", + "@typescript-eslint", + // TODO: Add support for Graphql + /*, "graphql" */ + ], + extends: [ + "eslint:recommended", + "plugin:react/recommended", + "plugin:react-hooks/recommended", + "plugin:@typescript-eslint/recommended", + "prettier", + ], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 6, + // This significantly slows down linting and is needed for type-aware lint + // checks which we don't have atm. + // project: "./tsconfig.json", + sourceType: "module", + }, + settings: { + react: { + version: "detect", + }, + }, + env: { + es6: true, + browser: true, + jest: true, + node: true, + }, + rules: { + "@typescript-eslint/ban-ts-ignore": 0, + "@typescript-eslint/camelcase": 0, + "@typescript-eslint/explicit-function-return-type": 0, + "@typescript-eslint/explicit-member-accessibility": 0, + "@typescript-eslint/indent": 0, + "@typescript-eslint/member-delimiter-style": 0, + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-inferrable-types": 0, + "@typescript-eslint/no-use-before-define": 0, + "@typescript-eslint/no-unused-vars": 0, + "@typescript-eslint/no-var-requires": 0, + "react/display-name": 0, + "react/prop-types": 0, + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn", + "sort-imports": [ + "warn", + { + // Unfortunately there's no autofixer for this + ignoreDeclarationSort: true, + }, + ], + + // FIXME: Investigate / reenable these rules. Disabled to introduce eslint + // into codebase. + "no-async-promise-executor": 0, + "no-case-declarations": 0, + "no-console": 0, + "no-constant-condition": 0, + "no-empty-pattern": 0, + "no-extra-boolean-cast": 0, + "no-inner-declarations": 0, + "no-irregular-whitespace": 0, + "no-prototype-builtins": 0, + "no-undef": 0, + "no-unreachable": 0, + "no-useless-escape": 0, + "prefer-const": 0, + "prefer-rest-params": 0, + "react/jsx-key": 0, + "react/jsx-no-target-blank": 0, + "react/no-direct-mutation-state": 0, + "react/no-find-dom-node": 0, + "react/no-unescaped-entities": 0, + "@typescript-eslint/no-empty-function": 0, + "@typescript-eslint/no-empty-interface": 0, + "@typescript-eslint/no-non-null-assertion": 0, + + // "@typescript-eslint/no-unused-vars": [ + // "error", + // { + // argsIgnorePattern: "^_", + // }, + // ], + // "no-console": [ + // "error", + // { + // allow: ["warn", "error"], + // }, + // ], + + // TODO: Add support for Graphql, but first need to fetch .json schema + // "graphql/template-strings": [ + // "error", + // { + // env: "relay", + // schemaJsonFilepath: path.resolve(__dirname, "./data/schema.json"), + // tagName: "graphql", + // }, + // ], + }, +} diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js index 998b053143f..a89dd9e82cf 100644 --- a/.storybook/webpack.config.js +++ b/.storybook/webpack.config.js @@ -22,7 +22,6 @@ const { CI, CMS_URL, ENABLE_SIGN_IN_WITH_APPLE, - EXPERIMENTAL_APP_SHELL, FACEBOOK_APP_NAMESPACE, PREDICTION_URL, FORCE_CLOUDFRONT_URL, @@ -56,7 +55,6 @@ const sharifyPath = sharify({ CDN_URL, CMS_URL, ENABLE_SIGN_IN_WITH_APPLE, - EXPERIMENTAL_APP_SHELL, FACEBOOK_APP_NAMESPACE, FORCE_CLOUDFRONT_URL, GEMINI_CLOUDFRONT_URL, diff --git a/.vscode/settings.json b/.vscode/settings.json index dd791c2295b..8cedeceb47c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,5 @@ { - "editor.rulers": [ - 80 - ], + "editor.rulers": [80], "editor.tabSize": 2, "javascript.validate.enable": true, "search.exclude": { @@ -31,7 +29,7 @@ ], "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.fixAll.tslint": true, + "source.fixAll.eslint": true, "source.fixAll.stylelint": true } } diff --git a/cypress/integration/partnerProfile.spec.js b/cypress/integration/partnerProfile.spec.js index 23e0a8caa74..837a74e2cf3 100644 --- a/cypress/integration/partnerProfile.spec.js +++ b/cypress/integration/partnerProfile.spec.js @@ -46,6 +46,7 @@ describe("/:partner_id", () => { }) it("shows partner articles", () => { cy.visit("gagosian-gallery/articles") + cy.wait(2000) cy.contains("Articles") }) diff --git a/data/schema.graphql b/data/schema.graphql index efe4199396b..298999fe101 100644 --- a/data/schema.graphql +++ b/data/schema.graphql @@ -698,6 +698,7 @@ type Artist implements EntityWithFilterArtworksConnectionInterface & Node & Sear priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -3168,6 +3169,22 @@ type ConditionReportRequest { userID: ID } +# Autogenerated input type of ConfirmPassword +input ConfirmPasswordInput { + # A unique identifier for the client performing the mutation. + clientMutationId: String + + # User password to confirm. + password: String! +} + +# Autogenerated return type of ConfirmPassword +type ConfirmPasswordPayload { + # A unique identifier for the client performing the mutation. + clientMutationId: String + valid: Boolean! +} + # Consignment Offer type ConsignmentOffer { commissionPercentWhole: Int @@ -3508,6 +3525,7 @@ type CreateAppSecondFactorPayload { input CreateBackupSecondFactorsInput { # A unique identifier for the client performing the mutation. clientMutationId: String + password: String } # Autogenerated return type of CreateBackupSecondFactors @@ -3632,12 +3650,21 @@ type CreateSubmissionMutationPayload { # Autogenerated input type of CreateViewingRoom input CreateViewingRoomInput { + # Main text + body: String! + # A unique identifier for the client performing the mutation. clientMutationId: String + # Introduction + introStatement: String! + # Partner Id partnerId: String! + # Pullquote + pullQuote: String + # Title title: String! } @@ -3869,6 +3896,7 @@ type dimensions { input DisableSecondFactorInput { # A unique identifier for the client performing the mutation. clientMutationId: String + password: String secondFactorID: ID! } @@ -3953,6 +3981,7 @@ input EnableSecondFactorInput { # A unique identifier for the client performing the mutation. clientMutationId: String code: String! + password: String secondFactorID: ID! } @@ -4016,6 +4045,7 @@ interface EntityWithFilterArtworksConnectionInterface { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -4153,6 +4183,7 @@ type Fair implements EntityWithFilterArtworksConnectionInterface & Node { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -4752,6 +4783,7 @@ type Gene implements Node & Searchable { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -5332,6 +5364,7 @@ type MarketingCollection { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -5794,6 +5827,7 @@ type Mutation { commerceSubmitPendingOffer( input: CommerceSubmitPendingOfferInput! ): CommerceSubmitPendingOfferPayload + confirmPassword(input: ConfirmPasswordInput!): ConfirmPasswordPayload # Create an account request createAccountRequest( @@ -6545,6 +6579,7 @@ type Query { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -7700,6 +7735,7 @@ type Show implements EntityWithFilterArtworksConnectionInterface & Node { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -8077,6 +8113,7 @@ type Tag implements Node { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String @@ -8437,6 +8474,7 @@ type Viewer { priceRange: String saleID: ID size: Int + sizeBuckets: [ArtworkSizes] sort: String tagID: String width: String diff --git a/docs/adding_new_app.md b/docs/adding_new_app.md new file mode 100644 index 00000000000..7bf7b944bb7 --- /dev/null +++ b/docs/adding_new_app.md @@ -0,0 +1,84 @@ +## Adding a new App to Force + +> Revised 5/27/2020 + +To add a new app to force we can leverage our React-based SSR router. + +- Create a new folder in [the apps directory](https://github.com/artsy/force/tree/master/src/v2/Apps) `v2/Apps/MyAppName` +- Create a new `routes.tsx` file +- Add some routes: + +```tsx +// routes.tsx +export const routes = [ + { + path: "/new-app", + Component: props => { + return ( +
+

Hello new app!

+
+ }, + children: [ + { + path: "artworks", + Component: () =>
Artworks list...
+ }, + { + path: "artists", + Component: () =>
Artists list...
+ } + ] + } +] +``` + +- Then add your routes to the [main route list](https://github.com/artsy/force/blob/master/src/v2/Apps/getAppRoutes.tsx): + +```tsx +import { routes as myNewAppRoutes } from "v2/Apps/MyNewApp/routes" + +export function getAppRoutes() { + return buildAppRoutes([ + { + routes: myNewAppRoutes, + }, + ]) +} +``` + +- Done! Now, when you visit `http://localhost:5000/new-app` you should see your newly created content above. + +### Advanced Setup + +For most apps we don't need more than the above to get a new route and SSR rendering out of the box. However, sometimes we need additional server-side functionality, be it redirects or something else that interacts directly with the request / response cycle. For that, we can leverage express.js middleware. + +Extending the example above, lets add a server-side redirect if the user isn't logged in: + +- Create a new folder that matches the above name in our [artsy-v2](https://github.com/artsy/force/tree/master/src/desktop/apps/artsy-v2) folder -- `apps/artsy-v2/apps/myNewAppName` +- Create a file called `myNewAppNameMiddleware.tsx` +- Add the following: + +```tsx +export function myNewAppNameMiddleware(req, res, next) { + const { pageType, pageParts } = getPageType(req) + + if (pageType === "myNewApp") { + if (!res.locals.sd.CURRENT_USER) { + return res.redirect( + `/login?redirectTo=${encodeURIComponent(req.originalUrl)}` + ) + } + } +} +``` + +- Then finally, add your middleware to [`apps/artsy-v2/apps/server.tsx`](https://github.com/artsy/force/blob/master/src/desktop/apps/artsy-v2/server.tsx) +- The same principle applies to client-side functionality. (Dig around [`artsy-v2/apps`](https://github.com/artsy/force/tree/master/src/desktop/apps/artsy-v2/apps) for a few examples.) + +This pattern is still evolving, but thats the gist. Middleware can be mounted in the same way that express subapps are mounted, so its just a matter of checking whether we're currently at a certain route and performing an action. diff --git a/jest.config.js b/jest.config.js index 9df50df3479..6f7bdef2d3d 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,9 +1,10 @@ const sharedConfig = { transform: { + "\\.(gql|graphql)$": "jest-transform-graphql", "^.+\\.coffee$": "/node_modules/jest-coffee-preprocessor/index.js", ".(ts|tsx|js|jsx)": "babel-jest", - "\\.graphql$": "jest-raw-loader", }, + cacheDirectory: ".cache/jest", coverageDirectory: "./coverage/", collectCoverage: true, coverageReporters: ["lcov", "text-summary"], diff --git a/package.json b/package.json index f30bded14e2..0fa6528f3c7 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "force", "version": "1.0.0", "private": true, + "license": "MIT", "engines": { "node": "12", "yarn": "1.x.x" @@ -20,6 +21,7 @@ "cypress": "./node_modules/.bin/cypress open", "integrate": "./scripts/quicklink-to-project.sh", "jest": "JEST_JUNIT_OUTPUT=reports/junit/js-test-results.xml jest --runInBand", + "lint": "eslint --cache --cache-location '.cache/eslint/' --ext ts,tsx --ignore-pattern 'src/v2/__generated__'", "mocha": "scripts/mocha.sh", "prepare": "patch-package", "prettier-project": "yarn run prettier-write 'src/**/*.{ts,tsx,js,jsx}'", @@ -41,27 +43,6 @@ "unlink-all": "yalc remove --all && yarn --check-files", "webpack": "node --max_old_space_size=2048 -r dotenv/config -r @babel/register node_modules/.bin/webpack --config ./webpack" }, - "prettier": { - "bracketSpacing": true, - "semi": false, - "singleQuote": false, - "trailingComma": "es5" - }, - "husky": { - "hooks": { - "pre-commit": "lint-staged", - "pre-push": "yarn type-check" - } - }, - "lint-staged": { - "*.@(js|jsx|ts|tsx)": [ - "npm run prettier-write --", - "git add" - ], - "{package.json,yarn.lock}": [ - "node ./scripts/check-for-links.js" - ] - }, "resolutions": { "@types/react": "16.9.34", "babel-core": "7.0.0-bridge.0", @@ -112,7 +93,6 @@ "artsy-ezel-components": "artsy/artsy-ezel-components", "artsy-morgan": "artsy/artsy-morgan", "artsy-xapp": "artsy/artsy-xapp", - "babel-eslint": "7.2.3", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "1.2.0", "babel-plugin-inline-react-svg": "0.2.0", @@ -246,7 +226,7 @@ "tti-polyfill": "0.2.2", "twilio": "2.11.1", "typeahead.js": "0.10.5", - "typescript": "3.8.3", + "typescript": "^3.9.3", "ua-parser-js": "0.7.19", "underscore": "1.8.3", "underscore.string": "3.3.5", @@ -304,7 +284,10 @@ "@types/underscore.string": "0.0.32", "@types/webpack": "4.4.24", "@types/webpack-env": "1.13.6", + "@typescript-eslint/eslint-plugin": "2.30.0", + "@typescript-eslint/parser": "2.30.0", "babel-core": "7.0.0-bridge.0", + "babel-eslint": "10.1.0", "babel-jest": "24.8.0", "babel-plugin-relay": "7.1.0", "benv": "3.3.0", @@ -316,18 +299,15 @@ "electron": "3.0.16", "enzyme": "3.10.0", "enzyme-adapter-react-16": "1.14.0", - "eslint": "5.6.1", - "eslint-config-prettier": "3.1.0", - "eslint-config-standard": "12.0.0", - "eslint-config-standard-react": "7.0.2", - "eslint-plugin-import": "2.14.0", - "eslint-plugin-node": "7.0.1", - "eslint-plugin-promise": "4.0.1", - "eslint-plugin-react": "7.11.1", - "eslint-plugin-standard": "4.0.0", + "eslint": "6.8.0", + "eslint-config-prettier": "6.11.0", + "eslint-plugin-graphql": "3.1.1", + "eslint-plugin-react": "7.19.0", + "eslint-plugin-react-hooks": "3.0.0", "fork-ts-checker-notifier-webpack-plugin": "0.4.0", "fork-ts-checker-webpack-plugin": "0.4.10", "friendly-errors-webpack-plugin": "1.6.1", + "graphql-tag": "^2.10.3", "graphql-tools": "4.0.3", "hulk-editor": "craigspaeth/hulk", "husky": "3.0.5", @@ -337,13 +317,13 @@ "jest": "24.9.0", "jest-coffee-preprocessor": "1.0.0", "jest-junit": "6.4.0", - "jest-raw-loader": "1.0.1", "jest-styled-components": "7.0.0-2", + "jest-transform-graphql": "^2.1.0", "jsdom": "11.6.2", "jsdom-global": "3.0.2", "json-loader": "0.5.7", "konami-js": "0.0.2", - "lint-staged": "9.2.5", + "lint-staged": "^10.2.6", "mime": "2.4.0", "mocha": "3.4.1", "mocha-junit-reporter": "1.22.0", @@ -351,7 +331,7 @@ "nightmare": "2.10.0", "patch-package": "6.2.0", "postinstall-prepare": "1.0.1", - "prettier": "1.19.1", + "prettier": "^2.0.5", "pug-loader": "2.4.0", "raw-loader": "0.5.1", "react-test-renderer": "16.8.6", @@ -371,10 +351,6 @@ "stylus-loader": "3.0.2", "supertest": "2.0.1", "terser-webpack-plugin": "2.3.5", - "tslint": "5.11.0", - "tslint-config-prettier": "1.15.0", - "tslint-config-standard": "8.0.1", - "tslint-react": "3.6.0", "typescript-styled-plugin": "0.15.0", "vscode-apollo-relay": "1.5.0", "wait-on": "3.3.0", @@ -386,13 +362,26 @@ "webpack-manifest-plugin": "2.0.4", "webpack-merge": "4.2.1", "webpack-notifier": "1.7.0", - "webpack-retry-chunk-load-plugin": "1.2.0", - "yalc": "1.0.0-pre.34" + "webpack-retry-chunk-load-plugin": "1.2.0" }, - "license": "MIT", "optionalDependencies": { "fsevents": "*" }, + "husky": { + "hooks": { + "pre-commit": "lint-staged", + "pre-push": "yarn type-check" + } + }, + "lint-staged": { + "*.@(md)": [ + "yarn prettier-write" + ], + "*.@(js|jsx|ts|tsx)": [ + "yarn lint --fix", + "yarn prettier-write" + ] + }, "reporterEnabled": "mocha-junit-reporter, spec", "mochaJunitReporterReporterOptions": { "mochaFile": "reports/mocha/test-results.xml" @@ -409,5 +398,12 @@ ".js" ], "lines": 0 + }, + "prettier": { + "bracketSpacing": true, + "printWidth": 80, + "semi": false, + "singleQuote": false, + "trailingComma": "es5" } } diff --git a/scripts/check-for-links.js b/scripts/check-for-links.js deleted file mode 100644 index d5ffa38ab04..00000000000 --- a/scripts/check-for-links.js +++ /dev/null @@ -1,69 +0,0 @@ -const { exec } = require("child_process") -const { createReadStream } = require("fs") -const chalk = require("chalk") - -const fileHasText = (file, text) => - new Promise((resolve, reject) => { - const stream = createReadStream(file) - let hasText = false - - stream.on("data", data => { - if (!hasText) { - hasText = !!(data + "").match(text) - } else { - stream.close() - } - }) - - stream.on("error", err => { - reject(err) - }) - stream.on("close", () => { - resolve(hasText) - }) - }) - -exec( - "yarn yalc check", - { - cwd: process.cwd(), - env: process.env, - shell: true, - }, - async (err, stdout) => { - if (err) { - const file = process.argv[2] - - // If there's no links in the lock file, ignore - if ( - file.includes("yarn.lock") && - !(await fileHasText(file, "file:.yalc")) - ) { - return - } - - // If there's no links in the package.json, ignore - if ( - file.includes("package.json") && - !(await fileHasText(file, "file:.yalc")) - ) { - return - } - - console.log("") - console.log( - chalk.yellow( - `Linking detected, can't commit ${file} until everything is unlinked.\n` - ) - ) - console.log("Linked packages:") - console.log(stdout.split(":")[1].split("]")[0] + "]\n") - console.log( - `Run ${chalk.bold( - "yarn unlink-all" - )} to fix. (Will run a yarn install).` - ) - process.exit(1) - } - } -) diff --git a/scripts/quicklink-to-project.sh b/scripts/quicklink-to-project.sh deleted file mode 100755 index 173377ec3ac..00000000000 --- a/scripts/quicklink-to-project.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -if [ -z "$1" ] && [ -z "$PROJECT_PATH" ]; then - echo "Must supply a project name or set the PROJECT_PATH env" -fi - -PROJECT=${PROJECT_PATH:-../$1} - -if [ ! -d "$PROJECT" ]; then - echo "$(realpath $PROJECT) doesn't exist, ensure project name is correct or PROJECT_PATH is pointing to a valid directory" - exit 1 -fi - -cd $PROJECT - -# Does package have integrate command? -cat package.json | jq -e .scripts.integrate &>2 - -if [ $? -ne 0 ]; then - # TODO: Reference documentation on the integration process - echo "$PROJECT doesn't have an `integrate` script in its package.json" - exit 1 -fi - -yarn integrate force \ No newline at end of file diff --git a/scripts/quicklink.sh b/scripts/quicklink.sh deleted file mode 100755 index 09209e6108c..00000000000 --- a/scripts/quicklink.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -# Add package as a "linked" package to force -echo "" -echo "Linking $1" -npx yalc add $1 - -# Try to install force's dependencies (retry if it fails) -echo "" -echo "Installing dependencies" -n=0 -until [ $n -ge 3 ] -do - yarn --check-files && break - - echo "Installing force dependencies failed, retrying... ($n/3)" - - n=$[$n+1] - sleep 1 -done - -echo "" -echo "Beginning service" -if [ -z "$ENABLE_DEBUGGER" ]; then - # Start force without debugger - TERM_PROGRAM=other yarn start -else - # Start force with debugger - yarn start -fi \ No newline at end of file diff --git a/src/desktop/analytics/inquiry_questionnaire.js b/src/desktop/analytics/inquiry_questionnaire.js index 03283569f81..1f33e254bdb 100644 --- a/src/desktop/analytics/inquiry_questionnaire.js +++ b/src/desktop/analytics/inquiry_questionnaire.js @@ -17,18 +17,15 @@ const analytics = window.analytics function getTrackingOptions() { var trackingOptions = {} - // FIXME: Remove once A/B test completes - if (sd.CLIENT_NAVIGATION_V5 === "experiment") { - const referrer = window.analytics.__artsyReferrer - // Grab referrer from our trackingMiddleware in Reaction, since we're in a - // single-page-app context and the value will need to be refreshed on route - // change. See: https://github.com/artsy/reaction/blob/master/src/Artsy/Analytics/trackingMiddleware.ts - if (referrer) { - trackingOptions = { - page: { - referrer, - }, - } + const referrer = window.analytics.__artsyReferrer + // Grab referrer from our trackingMiddleware in Reaction, since we're in a + // single-page-app context and the value will need to be refreshed on route + // change. See: https://github.com/artsy/reaction/blob/master/src/Artsy/Analytics/trackingMiddleware.ts + if (referrer) { + trackingOptions = { + page: { + referrer, + }, } } @@ -57,12 +54,7 @@ const analytics = window.analytics // _per session_, and therefore can't rely on `once`, as subsequent // inquiries would then not get tracked as there's no "hard jumps" // between pages. See: https://github.com/artsy/force/pull/5232 - // FIXME: Remove once A/B test completes - if (window.sd.CLIENT_NAVIGATION_V5 === "experiment") { - analyticsHooks.on(namespace(name), handler) - } else { - analyticsHooks.once(namespace(name), handler) - } + analyticsHooks.on(namespace(name), handler) } // DOM events diff --git a/src/desktop/analytics/main_layout.js b/src/desktop/analytics/main_layout.js index cbdf21084ca..a17dd00090a 100644 --- a/src/desktop/analytics/main_layout.js +++ b/src/desktop/analytics/main_layout.js @@ -23,6 +23,7 @@ const excludedRoutes = [ "/collect(.*)", "/collection(.*)", "/collections(.*)", + "/feature(.*)", "/identity-verification(.*)", "/orders(.*)", "/search(.*)", @@ -90,18 +91,15 @@ class PageTimeTracker { this.timer = setTimeout(() => { let trackingOptions = {} - // FIXME: Remove once A/B test completes - if (sd.CLIENT_NAVIGATION_V5 === "experiment") { - const referrer = window.analytics.__artsyReferrer - // Grab referrer from our trackingMiddleware in Reaction, since we're in a - // single-page-app context and the value will need to be refreshed on route - // change. See: https://github.com/artsy/reaction/blob/master/src/Artsy/Analytics/trackingMiddleware.ts - if (referrer) { - trackingOptions = { - page: { - referrer, - }, - } + const referrer = window.analytics.__artsyReferrer + // Grab referrer from our trackingMiddleware in Reaction, since we're in a + // single-page-app context and the value will need to be refreshed on route + // change. See: https://github.com/artsy/reaction/blob/master/src/Artsy/Analytics/trackingMiddleware.ts + if (referrer) { + trackingOptions = { + page: { + referrer, + }, } } diff --git a/src/desktop/apps/art_keeps_going/routes.tsx b/src/desktop/apps/art_keeps_going/routes.tsx index 640cbc77d93..babfda21980 100644 --- a/src/desktop/apps/art_keeps_going/routes.tsx +++ b/src/desktop/apps/art_keeps_going/routes.tsx @@ -5,7 +5,7 @@ import { routes } from "v2/Apps/FeatureAKG/routes" import JSONPage from "../../components/json_page" import React from "react" import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import { Request, Response, NextFunction } from "express" +import { NextFunction, Request, Response } from "express" export const landingPage = async ( req: Request, diff --git a/src/desktop/apps/article/__tests__/editorial_features.jest.ts b/src/desktop/apps/article/__tests__/editorial_features.jest.ts index b34b1b62afc..e00328484bb 100644 --- a/src/desktop/apps/article/__tests__/editorial_features.jest.ts +++ b/src/desktop/apps/article/__tests__/editorial_features.jest.ts @@ -1,8 +1,8 @@ import { - isCustomEditorial, getCustomEditorialId, - isVanguardSubArticle, getVanguardSubArticleContent, + isCustomEditorial, + isVanguardSubArticle, } from "../editorial_features" import { StandardArticle } from "@artsy/reaction/dist/Components/Publishing/Fixtures/Articles" diff --git a/src/desktop/apps/article/__tests__/helpers.jest.tsx b/src/desktop/apps/article/__tests__/helpers.jest.tsx index be981742466..7a8393c546a 100644 --- a/src/desktop/apps/article/__tests__/helpers.jest.tsx +++ b/src/desktop/apps/article/__tests__/helpers.jest.tsx @@ -1,11 +1,11 @@ import { shouldAdRender } from "desktop/apps/article/helpers" import { - NewsArticle as NewsArticleFixture, FeatureArticle, - StandardArticle, - VideoArticle, + NewsArticle as NewsArticleFixture, SeriesArticle, + StandardArticle, SuperArticle, + VideoArticle, VideoArticleUnpublished, } from "reaction/Components/Publishing/Fixtures/Articles" import React from "react" @@ -15,11 +15,11 @@ import { mount } from "enzyme" import { ArticleLayout } from "desktop/apps/article/components/layouts/Article" import { SystemContextProvider } from "reaction/Artsy" import { - isUnpublishedVideo, getBodyClass, getJsonLd, getLayoutTemplate, getSuperArticleTemplates, + isUnpublishedVideo, } from "../helpers" describe("ad display logic in Feature and Standard Articles", () => { diff --git a/src/desktop/apps/article/components/EditButton.tsx b/src/desktop/apps/article/components/EditButton.tsx index 57b1429d8f2..364b43e1da2 100644 --- a/src/desktop/apps/article/components/EditButton.tsx +++ b/src/desktop/apps/article/components/EditButton.tsx @@ -2,7 +2,7 @@ import * as React from "react" import ChannelMemberQuery from "desktop/apps/article/queries/channelMember" import { positronql } from "desktop/lib/positronql" import { data as sd } from "sharify" -import { map, includes } from "lodash" +import { includes, map } from "lodash" import { Box, space } from "@artsy/palette" interface EditButtonProps { diff --git a/src/desktop/apps/article/components/InfiniteScrollNewsArticle.tsx b/src/desktop/apps/article/components/InfiniteScrollNewsArticle.tsx index 618e486c038..e9e5203f84b 100644 --- a/src/desktop/apps/article/components/InfiniteScrollNewsArticle.tsx +++ b/src/desktop/apps/article/components/InfiniteScrollNewsArticle.tsx @@ -17,7 +17,7 @@ import { NewsDateDivider } from "reaction/Components/Publishing/News/NewsDateDiv const Cookies = require("desktop/components/cookies/index.coffee") import { shouldAdRender } from "desktop/apps/article/helpers" import { handleScrollingAuthModal } from "desktop/lib/openAuthModal" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" export interface Props { article?: ArticleData diff --git a/src/desktop/apps/article/components/__tests__/InfiniteScrollArticle.jest.tsx b/src/desktop/apps/article/components/__tests__/InfiniteScrollArticle.jest.tsx index 8f77378d0d4..b157f48aae4 100644 --- a/src/desktop/apps/article/components/__tests__/InfiniteScrollArticle.jest.tsx +++ b/src/desktop/apps/article/components/__tests__/InfiniteScrollArticle.jest.tsx @@ -3,8 +3,8 @@ import { mount } from "enzyme" import { SystemContextProvider } from "@artsy/reaction/dist/Artsy" import { InfiniteScrollArticle } from "../InfiniteScrollArticle" import { - StandardArticle, ShortStandardArticle, + StandardArticle, } from "@artsy/reaction/dist/Components/Publishing/Fixtures/Articles" import { Article } from "@artsy/reaction/dist/Components/Publishing/Article" import { clone } from "lodash" diff --git a/src/desktop/apps/article/components/layouts/Article.tsx b/src/desktop/apps/article/components/layouts/Article.tsx index 65679271945..ec6fe05e035 100644 --- a/src/desktop/apps/article/components/layouts/Article.tsx +++ b/src/desktop/apps/article/components/layouts/Article.tsx @@ -4,10 +4,10 @@ import { AppProps } from "../App" import { InfiniteScrollArticle } from "../InfiniteScrollArticle" import { shouldAdRender } from "desktop/apps/article/helpers" import { - openAuthModal, handleScrollingAuthModal, + openAuthModal, } from "desktop/lib/openAuthModal" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" const SuperArticleView = require("desktop/components/article/client/super_article.coffee") const ArticleModel = require("desktop/models/article.coffee") const Cookies = require("desktop/components/cookies/index.coffee") diff --git a/src/desktop/apps/article/routes.tsx b/src/desktop/apps/article/routes.tsx index f16fae259ba..5c9094a03f1 100644 --- a/src/desktop/apps/article/routes.tsx +++ b/src/desktop/apps/article/routes.tsx @@ -4,32 +4,32 @@ import { URL, resolve } from "url" import { App } from "desktop/apps/article/components/App" import ArticleQuery from "desktop/apps/article/queries/article" import { - SuperSubArticlesQuery, SuperArticleQuery, + SuperSubArticlesQuery, } from "desktop/apps/article/queries/superArticle" import { positronql } from "desktop/lib/positronql" import { data as sd } from "sharify" import { stitch } from "@artsy/stitch" import { getCurrentUnixTimestamp } from "@artsy/reaction/dist/Components/Publishing/Constants" import { - isCustomEditorial, getCustomEditorialId, - isVanguardSubArticle, getVanguardSubArticleContent, + isCustomEditorial, + isVanguardSubArticle, } from "./editorial_features" import { slugify } from "underscore.string" import { - isUnpublishedVideo, getBodyClass, getJsonLd, getLayoutTemplate, getSuperArticleTemplates, + isUnpublishedVideo, } from "./helpers" import cheerio from "cheerio" import React from "react" import { - partnerQuery, auctionQuery, + partnerQuery, } from "desktop/apps/article/queries/promotedContent" import { ArticleMeta } from "@artsy/reaction/dist/Components/Publishing/ArticleMeta" import { GalleryInsightsRedirects } from "./gallery_insights_redirects" diff --git a/src/desktop/apps/articles/components/AuthWrapper.tsx b/src/desktop/apps/articles/components/AuthWrapper.tsx index 1bf6e885458..c46def4a774 100644 --- a/src/desktop/apps/articles/components/AuthWrapper.tsx +++ b/src/desktop/apps/articles/components/AuthWrapper.tsx @@ -2,7 +2,7 @@ import React from "react" import { data as sd } from "sharify" import qs from "querystring" import { handleScrollingAuthModal } from "desktop/lib/openAuthModal" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" const Cookies = require("desktop/components/cookies/index.coffee") const mediator = require("desktop/lib/mediator.coffee") diff --git a/src/desktop/apps/articles/routes.ts b/src/desktop/apps/articles/routes.ts index 201a9b8e05c..3ed4a6e0a26 100644 --- a/src/desktop/apps/articles/routes.ts +++ b/src/desktop/apps/articles/routes.ts @@ -5,7 +5,7 @@ import { newsPanelQuery, } from "./queries/news_articles_query" import { positronql as _positronql } from "desktop/lib/positronql" -import { map, sortBy, first, last, reject } from "lodash" +import { first, last, map, reject, sortBy } from "lodash" const { crop } = require("desktop/components/resizer/index.coffee") const { PARSELY_KEY, PARSELY_SECRET } = require("../../config.coffee") const _topParselyArticles = require("desktop/components/util/parsely.coffee") diff --git a/src/desktop/apps/artist/client.tsx b/src/desktop/apps/artist/client.tsx deleted file mode 100644 index b4c2b8923fc..00000000000 --- a/src/desktop/apps/artist/client.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { data as sd } from "sharify" -import { routes } from "v2/Apps/Artist/routes" -import React from "react" -import ReactDOM from "react-dom" -import { setupArtistSignUpModal } from "desktop/apps/artist/components/cta" -import { loadableReady } from "@loadable/component" - -const mediator = require("desktop/lib/mediator.coffee") - -buildClientApp({ - routes, - context: { - user: sd.CURRENT_USER, - mediator, - } as any, -}) - .then(({ ClientApp }) => { - loadableReady(() => { - ReactDOM.hydrate( - , - document.getElementById("react-root"), - () => { - setupArtistSignUpModal() - } - ) - }) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/artist/server.tsx b/src/desktop/apps/artist/server.tsx deleted file mode 100644 index 9b199053a2a..00000000000 --- a/src/desktop/apps/artist/server.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/server" -import { stitch } from "@artsy/stitch" -import { routes } from "v2/Apps/Artist/routes" -import React from "react" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import express, { Request, Response, NextFunction } from "express" -import { skipIfClientSideRoutingEnabled } from "desktop/components/split_test/skipIfClientSideRoutingEnabled" - -export const app = express() - -app.get( - "/artist/:artistID*", - skipIfClientSideRoutingEnabled, - async (req: Request, res: Response, next: NextFunction) => { - try { - const user = req.user && req.user.toJSON() - - const context = buildServerAppContext(req, res, {}) - const { - bodyHTML, - redirect, - status, - headTags, - styleTags, - scripts, - } = await buildServerApp({ - routes, - url: req.url, - userAgent: req.header("User-Agent"), - context, - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - const { APP_URL, IS_MOBILE, REFERRER } = res.locals.sd - const isExternalReferer = !(REFERRER && REFERRER.includes(APP_URL)) - - res.locals.sd.ARTIST_PAGE_CTA_ENABLED = - !user && isExternalReferer && !IS_MOBILE - res.locals.sd.ARTIST_PAGE_CTA_ARTIST_ID = req.params.artistID - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => {headTags}, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "artist", - scripts, - styleTags, - }, - }) - - res.locals.PAGE_CACHE = { status, key: req.url, html: layout } - - res.status(status).send(layout) - } catch (error) { - next(error) - } - } -) diff --git a/src/desktop/apps/experimental-app-shell/apps/artist/__tests__/artistMiddleware.jest.ts b/src/desktop/apps/artsy-v2/apps/artist/__tests__/artistMiddleware.jest.ts similarity index 100% rename from src/desktop/apps/experimental-app-shell/apps/artist/__tests__/artistMiddleware.jest.ts rename to src/desktop/apps/artsy-v2/apps/artist/__tests__/artistMiddleware.jest.ts diff --git a/src/desktop/apps/artsy-v2/apps/artist/artistClient.tsx b/src/desktop/apps/artsy-v2/apps/artist/artistClient.tsx new file mode 100644 index 00000000000..6d30f97ea40 --- /dev/null +++ b/src/desktop/apps/artsy-v2/apps/artist/artistClient.tsx @@ -0,0 +1,5 @@ +import { setupArtistSignUpModal } from "desktop/components/artistSignupModal/artistSignupModal" + +export const artistClient = () => { + setupArtistSignUpModal() +} diff --git a/src/desktop/apps/experimental-app-shell/apps/artist/artistMiddleware.tsx b/src/desktop/apps/artsy-v2/apps/artist/artistMiddleware.tsx similarity index 100% rename from src/desktop/apps/experimental-app-shell/apps/artist/artistMiddleware.tsx rename to src/desktop/apps/artsy-v2/apps/artist/artistMiddleware.tsx diff --git a/src/desktop/apps/experimental-app-shell/apps/artwork/__tests__/artworkMiddleware.jest.ts b/src/desktop/apps/artsy-v2/apps/artwork/__tests__/artworkMiddleware.jest.ts similarity index 100% rename from src/desktop/apps/experimental-app-shell/apps/artwork/__tests__/artworkMiddleware.jest.ts rename to src/desktop/apps/artsy-v2/apps/artwork/__tests__/artworkMiddleware.jest.ts diff --git a/src/desktop/apps/experimental-app-shell/apps/artwork/artworkClient.tsx b/src/desktop/apps/artsy-v2/apps/artwork/artworkClient.tsx similarity index 97% rename from src/desktop/apps/experimental-app-shell/apps/artwork/artworkClient.tsx rename to src/desktop/apps/artsy-v2/apps/artwork/artworkClient.tsx index 7f4ab5503d4..5a86e08df63 100644 --- a/src/desktop/apps/experimental-app-shell/apps/artwork/artworkClient.tsx +++ b/src/desktop/apps/artsy-v2/apps/artwork/artworkClient.tsx @@ -7,7 +7,7 @@ export const artworkClient = () => { const Artwork = require("desktop/models/artwork.coffee") const ArtworkInquiry = require("desktop/models/artwork_inquiry.coffee") const openInquiryQuestionnaireFor = require("desktop/components/inquiry_questionnaire/index.coffee") - const openAuctionBuyerPremium = require("desktop/apps/artwork/components/buyers_premium/index.coffee") + const openAuctionBuyerPremium = require("desktop/components/artworkBuyersPremium/index.coffee") const ViewInRoomView = require("desktop/components/view_in_room/view.coffee") const $ = require("jquery") const mediator = require("desktop/lib/mediator.coffee") diff --git a/src/desktop/apps/experimental-app-shell/apps/artwork/artworkMiddleware.tsx b/src/desktop/apps/artsy-v2/apps/artwork/artworkMiddleware.tsx similarity index 87% rename from src/desktop/apps/experimental-app-shell/apps/artwork/artworkMiddleware.tsx rename to src/desktop/apps/artsy-v2/apps/artwork/artworkMiddleware.tsx index e55120885f5..3efff4779b8 100644 --- a/src/desktop/apps/experimental-app-shell/apps/artwork/artworkMiddleware.tsx +++ b/src/desktop/apps/artsy-v2/apps/artwork/artworkMiddleware.tsx @@ -13,12 +13,7 @@ export const handleArtworkImageDownload = async (req, res, next) => { if (req.user) { imageRequest.set("X-ACCESS-TOKEN", req.user.get("accessToken")) } - req - .pipe( - imageRequest, - { end: false } - ) - .pipe(res) + req.pipe(imageRequest, { end: false }).pipe(res) } else { const error: any = new Error("Not authorized to download this image.") error.status = 403 diff --git a/src/desktop/apps/experimental-app-shell/apps/search/__tests__/searchMiddleware.jest.ts b/src/desktop/apps/artsy-v2/apps/search/__tests__/searchMiddleware.jest.ts similarity index 100% rename from src/desktop/apps/experimental-app-shell/apps/search/__tests__/searchMiddleware.jest.ts rename to src/desktop/apps/artsy-v2/apps/search/__tests__/searchMiddleware.jest.ts diff --git a/src/desktop/apps/experimental-app-shell/apps/search/searchMiddleware.tsx b/src/desktop/apps/artsy-v2/apps/search/searchMiddleware.tsx similarity index 94% rename from src/desktop/apps/experimental-app-shell/apps/search/searchMiddleware.tsx rename to src/desktop/apps/artsy-v2/apps/search/searchMiddleware.tsx index 99f1d2994bb..c1d28b52193 100644 --- a/src/desktop/apps/experimental-app-shell/apps/search/searchMiddleware.tsx +++ b/src/desktop/apps/artsy-v2/apps/search/searchMiddleware.tsx @@ -30,8 +30,7 @@ export const searchMiddleware = async (req, res, next) => { const layout = await stitch({ basePath: __dirname, - layout: - "../../../../components/main_layout/templates/experimental_app_shell.jade", + layout: "../../../../components/main_layout/templates/artsy_v2.jade", blocks: { loadingComponent: _props => { return ( diff --git a/src/desktop/apps/experimental-app-shell/client.tsx b/src/desktop/apps/artsy-v2/client.tsx similarity index 97% rename from src/desktop/apps/experimental-app-shell/client.tsx rename to src/desktop/apps/artsy-v2/client.tsx index 3935df32b3d..e69530762cd 100644 --- a/src/desktop/apps/experimental-app-shell/client.tsx +++ b/src/desktop/apps/artsy-v2/client.tsx @@ -12,7 +12,6 @@ const mediator = require("desktop/lib/mediator.coffee") buildClientApp({ routes: getAppRoutes(), context: { - EXPERIMENTAL_APP_SHELL: true, user: sd.CURRENT_USER, mediator, } as any, diff --git a/src/desktop/apps/experimental-app-shell/middleware/__tests__/userRequiredMiddleware.jest.ts b/src/desktop/apps/artsy-v2/middleware/__tests__/userRequiredMiddleware.jest.ts similarity index 100% rename from src/desktop/apps/experimental-app-shell/middleware/__tests__/userRequiredMiddleware.jest.ts rename to src/desktop/apps/artsy-v2/middleware/__tests__/userRequiredMiddleware.jest.ts diff --git a/src/desktop/apps/experimental-app-shell/middleware/userRequiredMiddleware.tsx b/src/desktop/apps/artsy-v2/middleware/userRequiredMiddleware.tsx similarity index 100% rename from src/desktop/apps/experimental-app-shell/middleware/userRequiredMiddleware.tsx rename to src/desktop/apps/artsy-v2/middleware/userRequiredMiddleware.tsx diff --git a/src/desktop/apps/experimental-app-shell/server.tsx b/src/desktop/apps/artsy-v2/server.tsx similarity index 87% rename from src/desktop/apps/experimental-app-shell/server.tsx rename to src/desktop/apps/artsy-v2/server.tsx index 5b68db7125b..2118912cc3f 100644 --- a/src/desktop/apps/experimental-app-shell/server.tsx +++ b/src/desktop/apps/artsy-v2/server.tsx @@ -22,15 +22,6 @@ app.get("/artwork/:artworkID/download/:filename", handleArtworkImageDownload) */ app.get( "/*", - (_req, res, next) => { - const isExperiment = res.locals.sd.CLIENT_NAVIGATION_V5 === "experiment" - - if (!isExperiment) { - return next("route") - } - return next() - }, - userRequiredMiddleware, /** @@ -58,9 +49,7 @@ app.get( bodyHTML, headTags, } = await buildServerApp({ - context: buildServerAppContext(req, res, { - EXPERIMENTAL_APP_SHELL: true, - }), + context: buildServerAppContext(req, res), routes: getAppRoutes(), url: req.url, userAgent: req.header("User-Agent"), @@ -77,8 +66,7 @@ app.get( const layout = await stitch({ basePath: __dirname, - layout: - "../../components/main_layout/templates/experimental_app_shell.jade", + layout: "../../components/main_layout/templates/artsy_v2.jade", blocks: { body: bodyHTML, head: () => <>{headTags}, diff --git a/src/desktop/apps/experimental-app-shell/utils/__tests__/getPageType.jest.ts b/src/desktop/apps/artsy-v2/utils/__tests__/getPageType.jest.ts similarity index 100% rename from src/desktop/apps/experimental-app-shell/utils/__tests__/getPageType.jest.ts rename to src/desktop/apps/artsy-v2/utils/__tests__/getPageType.jest.ts diff --git a/src/desktop/apps/experimental-app-shell/utils/getPageType.ts b/src/desktop/apps/artsy-v2/utils/getPageType.ts similarity index 100% rename from src/desktop/apps/experimental-app-shell/utils/getPageType.ts rename to src/desktop/apps/artsy-v2/utils/getPageType.ts diff --git a/src/desktop/apps/artsy_in_miami/components/MiamiFairWeekPage.tsx b/src/desktop/apps/artsy_in_miami/components/MiamiFairWeekPage.tsx index ffe78e7b63d..17c197594f0 100644 --- a/src/desktop/apps/artsy_in_miami/components/MiamiFairWeekPage.tsx +++ b/src/desktop/apps/artsy_in_miami/components/MiamiFairWeekPage.tsx @@ -2,7 +2,7 @@ import React from "react" import styled, { ThemeProvider } from "styled-components" import colors from "v2/Assets/Colors" -import { Row, Col } from "@artsy/palette" +import { Col, Row } from "@artsy/palette" import Text from "v2/Components/Text" import Title from "v2/Components/Title" diff --git a/src/desktop/apps/artwork/__tests__/client.jest.ts b/src/desktop/apps/artwork/__tests__/client.jest.ts deleted file mode 100644 index 2a70251c582..00000000000 --- a/src/desktop/apps/artwork/__tests__/client.jest.ts +++ /dev/null @@ -1,111 +0,0 @@ -import Backbone from "backbone" -const mediator = require("desktop/lib/mediator.coffee") - -jest.mock("react-dom", () => ({ - hydrate: jest.fn(), -})) -jest.mock("desktop/components/inquiry_questionnaire/index.coffee", () => - jest.fn() -) - -jest.mock("desktop/components/cookies/index.coffee", () => ({ - get: jest.fn(), - expire: jest.fn(), - set: jest.fn(), -})) -const mockCookies = require("desktop/components/cookies/index.coffee") - .get as jest.Mock - -const inquiryMock = require("desktop/components/inquiry_questionnaire/index.coffee") -const mediatorTriggerMock = jest.spyOn(mediator, "trigger") - -require("../client") - -describe("artwork client", () => { - Backbone.sync = jest.fn() - document.getElementById = jest.fn() - - beforeEach(() => { - mockCookies.mockClear() - mediatorTriggerMock.mockClear() - inquiryMock.mockClear() - Backbone.sync.mockImplementation(() => Promise.resolve()) - }) - - describe("Launch inquiry", () => { - describe("Contact gallery", () => { - it("launchInquiryFlow does not trigger auth modal", async () => { - await mediator.trigger("launchInquiryFlow", { - artworkId: "chip-hughes-stripes", - }) - expect(mediatorTriggerMock).toBeCalledTimes(1) - expect(mediatorTriggerMock).toBeCalledWith("launchInquiryFlow", { - artworkId: "chip-hughes-stripes", - }) - }) - - it("launchInquiryFlow triggers inquiry modal", async () => { - await mediator.trigger("launchInquiryFlow", { - artworkId: "chip-hughes-stripes", - }) - expect(Backbone.sync).toBeCalled() - expect(inquiryMock.mock.calls[0][0].artwork.get("id")).toBe( - "chip-hughes-stripes" - ) - expect(inquiryMock.mock.calls[0][0].ask_specialist).toBeFalsy() - }) - }) - - describe("Ask a specialist", () => { - it("openBuyNowAskSpecialistModal does not trigger auth modal", async () => { - await mediator.trigger("openBuyNowAskSpecialistModal", { - artworkId: "chip-hughes-stripes", - }) - expect(mediatorTriggerMock).toBeCalledTimes(1) - expect(mediatorTriggerMock).toBeCalledWith( - "openBuyNowAskSpecialistModal", - { - artworkId: "chip-hughes-stripes", - } - ) - }) - - it("openBuyNowAskSpecialistModal triggers inquiry modal", async () => { - await mediator.trigger("openBuyNowAskSpecialistModal", { - artworkId: "chip-hughes-stripes", - }) - expect(Backbone.sync).toBeCalled() - expect(inquiryMock.mock.calls[0][0].artwork.get("id")).toBe( - "chip-hughes-stripes" - ) - expect(inquiryMock.mock.calls[0][0].ask_specialist).toBeTruthy() - }) - }) - - describe("Ask an auction specialist", () => { - it("openAuctionAskSpecialistModal does not trigger auth modal", async () => { - await mediator.trigger("openAuctionAskSpecialistModal", { - artworkId: "chip-hughes-stripes", - }) - expect(mediatorTriggerMock).toBeCalledTimes(1) - expect(mediatorTriggerMock).toBeCalledWith( - "openAuctionAskSpecialistModal", - { - artworkId: "chip-hughes-stripes", - } - ) - }) - - it("openAuctionAskSpecialistModal triggers inquiry modal", async () => { - await mediator.trigger("openAuctionAskSpecialistModal", { - artworkId: "chip-hughes-stripes", - }) - expect(Backbone.sync).toBeCalled() - expect(inquiryMock.mock.calls[0][0].artwork.get("id")).toBe( - "chip-hughes-stripes" - ) - expect(inquiryMock.mock.calls[0][0].ask_specialist).toBeTruthy() - }) - }) - }) -}) diff --git a/src/desktop/apps/artwork/__tests__/routes.jest.ts b/src/desktop/apps/artwork/__tests__/routes.jest.ts deleted file mode 100644 index 31992729f5e..00000000000 --- a/src/desktop/apps/artwork/__tests__/routes.jest.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { handleDownload } from "../server" - -const Artwork = require("desktop/models/artwork.coffee") - -jest.mock("superagent", () => { - return { - get: () => { - return { set: jest.fn() } - }, - } -}) - -jest.mock("desktop/models/artwork.coffee") - -describe("Request handler for download artwork route", () => { - let req - let res - let next - const pipeMock = jest.fn() - - describe("/artwork/:artworkID/download/:filename", () => { - beforeEach(() => { - req = { - params: { artworkID: "percy-painting" }, - user: { get: () => "token" }, - pipe: () => { - return { pipe: pipeMock } - }, - } - - next = jest.fn() - }) - - it("serves a 403", done => { - Artwork.mockImplementation(() => { - return { - isDownloadable: () => { - return false - }, - fetch: () => jest.fn(), - } - }) - handleDownload(req, res, next).then(() => { - expect(next).toHaveBeenCalledWith( - expect.objectContaining({ - message: "Not authorized to download this image.", - status: 403, - }) - ) - done() - }) - }) - - it("pipes the image when the request is authorized", done => { - Artwork.mockImplementation(() => { - return { - isDownloadable: () => { - return true - }, - fetch: () => jest.fn(), - downloadableUrl: () => jest.fn(), - } - }) - handleDownload(req, res, next).then(() => { - expect(pipeMock).toHaveBeenCalled() - done() - }) - }) - }) -}) diff --git a/src/desktop/apps/artwork/client.tsx b/src/desktop/apps/artwork/client.tsx deleted file mode 100644 index f3ad86ba881..00000000000 --- a/src/desktop/apps/artwork/client.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { routes } from "v2/Apps/Artwork/routes" -import { data as sd } from "sharify" -import React from "react" -import ReactDOM from "react-dom" -import { enableIntercom } from "lib/intercom" -import { recordArtworkView } from "lib/components/record_artwork_view" -import { loadableReady } from "@loadable/component" - -const $ = require("jquery") -const mediator = require("desktop/lib/mediator.coffee") -const User = require("desktop/models/user.coffee") -const Artwork = require("desktop/models/artwork.coffee") -const ArtworkInquiry = require("desktop/models/artwork_inquiry.coffee") -const openInquiryQuestionnaireFor = require("desktop/components/inquiry_questionnaire/index.coffee") -const openAuctionBuyerPremium = require("desktop/apps/artwork/components/buyers_premium/index.coffee") -const ViewInRoomView = require("desktop/components/view_in_room/view.coffee") - -buildClientApp({ - routes, - context: { - user: sd.CURRENT_USER, - mediator, - }, -}) - .then(({ ClientApp }) => { - loadableReady(() => { - ReactDOM.hydrate(, document.getElementById("react-root")) - }) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} - -const artworkSlug = location.pathname.replace(/\/artwork\//, "") -recordArtworkView(artworkSlug, sd.CURRENT_USER) - -const openInquireableModal = ( - artworkId: string, - { ask_specialist }, - artworkOptions = {} -) => { - if (!artworkId) return - const user = User.instantiate() - const inquiry = new ArtworkInquiry({ notification_delay: 600 }) - const artwork = new Artwork({ id: artworkId }) - - // TODO: Look into why this is needed. - $.ajaxSettings.headers = { - "X-XAPP-TOKEN": sd.ARTSY_XAPP_TOKEN, - "X-ACCESS-TOKEN": - sd.CURRENT_USER != null ? sd.CURRENT_USER.accessToken : undefined, - } - artwork.fetch().then(() => { - artwork.set(artworkOptions) - openInquiryQuestionnaireFor({ - user, - artwork, - inquiry, - ask_specialist, - }) - }) -} - -mediator.on("launchInquiryFlow", options => { - openInquireableModal(options.artworkId, { ask_specialist: false }) -}) - -mediator.on("openBuyNowAskSpecialistModal", options => { - openInquireableModal(options.artworkId, { ask_specialist: true }) -}) - -mediator.on("openAuctionAskSpecialistModal", options => { - openInquireableModal( - options.artworkId, - { ask_specialist: true }, - { is_in_auction: true } - ) -}) - -mediator.on("openViewInRoom", options => { - try { - const { dimensions } = options - const { url, width, height } = options.image - - let newWidth = width - let newHeight = height - - const bounds = document - .querySelector("[data-is-default=true]") - .getBoundingClientRect() - - const imgRatio = newWidth / newHeight - const boundsRatio = bounds.width / bounds.height - - if (boundsRatio > imgRatio) { - newHeight = bounds.height - newWidth = (newHeight * width) / height - } else if (boundsRatio < imgRatio) { - newWidth = bounds.width - newHeight = (height * newWidth) / width - } else { - newWidth = bounds.width - newHeight = newWidth - } - - const newLeft = (bounds.width - newWidth) / 2 + bounds.left - const newTop = bounds.top + Math.abs(bounds.height - newHeight) / 2 - - const positionStyles = { - position: "absolute", - top: `${newTop}px`, - left: `${newLeft}px`, - width: `${newWidth}px`, - height: `${newHeight}px`, - } - - const viewInRoom = new ViewInRoomView({ - imgSelector: "[data-type=artwork-image]", - imgUrl: url, - positionStyles: positionStyles, - dimensions: dimensions.cm, - }) - - $("body").prepend(viewInRoom.render().$el) - } catch { - // TODO: Add some proper error handling - } -}) - -mediator.on("openAuctionBuyerPremium", options => { - openAuctionBuyerPremium(options.auctionId) -}) - -mediator.on("enableIntercomForBuyers", options => { - enableIntercom(options) -}) diff --git a/src/desktop/apps/artwork/server.tsx b/src/desktop/apps/artwork/server.tsx deleted file mode 100644 index 7d57eac3e34..00000000000 --- a/src/desktop/apps/artwork/server.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import React from "react" -import { buildServerApp } from "v2/Artsy/Router/server" -import { routes } from "v2/Apps/Artwork/routes" -import { stitch } from "@artsy/stitch" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import express, { Request, Response, NextFunction } from "express" -import request from "superagent" -import { skipIfClientSideRoutingEnabled } from "desktop/components/split_test/skipIfClientSideRoutingEnabled" - -const Artwork = require("desktop/models/artwork.coffee") - -export const app = express() - -export const handleDownload = async ( - req: Request, - res: Response, - next: NextFunction -) => { - const artwork = new Artwork({ id: req.params.artworkID }) - await artwork.fetch({ - cache: true, - }) - - if (artwork.isDownloadable(req.user)) { - const imageRequest = request.get(artwork.downloadableUrl(req.user)) - if (req.user) { - imageRequest.set("X-ACCESS-TOKEN", req.user.get("accessToken")) - } - req.pipe(imageRequest, { end: false }).pipe(res) - } else { - const error: any = new Error("Not authorized to download this image.") - error.status = 403 - next(error) - } -} - -app.get("/artwork/:artworkID/download/:filename", handleDownload) - -app.get( - "/artwork/:artworkID*", - skipIfClientSideRoutingEnabled, - async (req: Request, res: Response, next: NextFunction) => { - const { GOOGLE_ADWORDS_ID } = res.locals.sd - - const context = buildServerAppContext(req, res, { - googleAdId: GOOGLE_ADWORDS_ID, - }) - - try { - const { - bodyHTML, - redirect, - status, - headTags, - styleTags, - scripts, - } = await buildServerApp({ - routes, - url: req.url, - userAgent: req.header("User-Agent"), - context, - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => {headTags}, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "artwork", - scripts, - styleTags, - }, - }) - - res.status(status).send(layout) - } catch (error) { - next(error) - } - } -) diff --git a/src/desktop/apps/auction_reaction/routes.jest.ts b/src/desktop/apps/auction_reaction/routes.jest.ts index faf168f8158..69cfb9a4190 100644 --- a/src/desktop/apps/auction_reaction/routes.jest.ts +++ b/src/desktop/apps/auction_reaction/routes.jest.ts @@ -1,4 +1,4 @@ -import { bidderRegistration, auctionFAQRoute } from "./routes" +import { auctionFAQRoute, bidderRegistration } from "./routes" import { stitch } from "@artsy/stitch" jest.mock("v2/Artsy/Router/server", () => { diff --git a/src/desktop/apps/auction_reaction/server.tsx b/src/desktop/apps/auction_reaction/server.tsx index fc2eea8098e..9132f00ee99 100644 --- a/src/desktop/apps/auction_reaction/server.tsx +++ b/src/desktop/apps/auction_reaction/server.tsx @@ -1,5 +1,5 @@ import express from "express" -import { bidderRegistration, auctionFAQRoute, confirmBidRoute } from "./routes" +import { auctionFAQRoute, bidderRegistration, confirmBidRoute } from "./routes" export const app = express() diff --git a/src/desktop/apps/auction_support/index.coffee b/src/desktop/apps/auction_support/index.coffee index fbe0f3dcdc8..4e98482430c 100644 --- a/src/desktop/apps/auction_support/index.coffee +++ b/src/desktop/apps/auction_support/index.coffee @@ -1,6 +1,5 @@ express = require 'express' routes = require './routes' -{ skipIfClientSideRoutingEnabled } = require("../../components/split_test/skipIfClientSideRoutingEnabled") app = module.exports = express() app.set 'views', __dirname + '/templates' diff --git a/src/desktop/apps/authentication/__tests__/helpers.jest.ts b/src/desktop/apps/authentication/__tests__/helpers.jest.ts index d8ab3d10348..b7ee9361e4d 100644 --- a/src/desktop/apps/authentication/__tests__/helpers.jest.ts +++ b/src/desktop/apps/authentication/__tests__/helpers.jest.ts @@ -1,8 +1,8 @@ import { + apiAuthWithRedirectUrl, + getRedirect, handleSubmit, setCookies, - getRedirect, - apiAuthWithRedirectUrl, } from "../helpers" import Backbone from "backbone" import $ from "jquery" diff --git a/src/desktop/apps/authentication/__tests__/routes.jest.ts b/src/desktop/apps/authentication/__tests__/routes.jest.ts index 53f05cc9046..7e424ba4976 100644 --- a/src/desktop/apps/authentication/__tests__/routes.jest.ts +++ b/src/desktop/apps/authentication/__tests__/routes.jest.ts @@ -1,6 +1,6 @@ import { AuthStatic } from "../components/AuthStatic" import { MobileAuthStatic } from "../components/MobileAuthStatic" -import { index, resetPassword, redirectLoggedInHome } from "../routes" +import { index, redirectLoggedInHome, resetPassword } from "../routes" jest.mock("@artsy/stitch", () => ({ stitch: jest.fn(), diff --git a/src/desktop/apps/authentication/components/AuthStatic.tsx b/src/desktop/apps/authentication/components/AuthStatic.tsx index 3d711edd9a1..3a9ad897ee4 100644 --- a/src/desktop/apps/authentication/components/AuthStatic.tsx +++ b/src/desktop/apps/authentication/components/AuthStatic.tsx @@ -1,6 +1,6 @@ import React from "react" import { FormSwitcher } from "v2/Components/Authentication/FormSwitcher" -import { ModalType, ModalOptions } from "v2/Components/Authentication/Types" +import { ModalOptions, ModalType } from "v2/Components/Authentication/Types" import { ModalHeader } from "v2/Components/Modal/ModalHeader" import { handleSubmit } from "../helpers" import { Box, Flex } from "@artsy/palette" diff --git a/src/desktop/apps/authentication/components/MobileAuthStatic.tsx b/src/desktop/apps/authentication/components/MobileAuthStatic.tsx index 3deb142e60c..fc22bbd65a6 100644 --- a/src/desktop/apps/authentication/components/MobileAuthStatic.tsx +++ b/src/desktop/apps/authentication/components/MobileAuthStatic.tsx @@ -2,8 +2,8 @@ import React from "react" import styled from "styled-components" import { FormSwitcher } from "v2/Components/Authentication/FormSwitcher" import { handleSubmit } from "../helpers" -import { ModalType, ModalOptions } from "v2/Components/Authentication/Types" -import { Box, color, Flex } from "@artsy/palette" +import { ModalOptions, ModalType } from "v2/Components/Authentication/Types" +import { Box, Flex, color } from "@artsy/palette" interface Props { type: string diff --git a/src/desktop/apps/authentication/components/ModalContainer.tsx b/src/desktop/apps/authentication/components/ModalContainer.tsx index 2bdc41e41a0..166e450e428 100644 --- a/src/desktop/apps/authentication/components/ModalContainer.tsx +++ b/src/desktop/apps/authentication/components/ModalContainer.tsx @@ -3,8 +3,8 @@ import React from "react" import { data as sd } from "sharify" import { - createdAccount, AuthService, + createdAccount, successfullyLoggedIn, } from "@artsy/cohesion" import { handleSubmit, setCookies } from "../helpers" diff --git a/src/desktop/apps/authentication/helpers.ts b/src/desktop/apps/authentication/helpers.ts index adea70c3a1e..1035f60a76c 100644 --- a/src/desktop/apps/authentication/helpers.ts +++ b/src/desktop/apps/authentication/helpers.ts @@ -1,14 +1,14 @@ import Cookies from "cookies-js" -import { ModalType, ModalOptions } from "v2/Components/Authentication/Types" +import { ModalOptions, ModalType } from "v2/Components/Authentication/Types" import { data as sd } from "sharify" import * as qs from "query-string" import { Response } from "express" import { captureException } from "@sentry/browser" import { - createdAccount, AuthService, - successfullyLoggedIn, + createdAccount, resetYourPassword, + successfullyLoggedIn, } from "@artsy/cohesion" import { omit } from "lodash" diff --git a/src/desktop/apps/authentication/index.ts b/src/desktop/apps/authentication/index.ts index daf2e011c85..c1cfeecbe47 100644 --- a/src/desktop/apps/authentication/index.ts +++ b/src/desktop/apps/authentication/index.ts @@ -1,5 +1,5 @@ import express from "express" -import { index, resetPassword, redirectLoggedInHome } from "./routes" +import { index, redirectLoggedInHome, resetPassword } from "./routes" export const app = express() diff --git a/src/desktop/apps/collect/client.js b/src/desktop/apps/collect/client.js deleted file mode 100644 index 8a9976069f3..00000000000 --- a/src/desktop/apps/collect/client.js +++ /dev/null @@ -1,27 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/buildClientApp" -import { data as sd } from "sharify" -import { collectRoutes } from "v2/Apps/Collect/collectRoutes" -import mediator from "desktop/lib/mediator.coffee" -import React from "react" -import ReactDOM from "react-dom" -import { loadableReady } from "@loadable/component" - -buildClientApp({ - routes: collectRoutes, - context: { - user: sd.CURRENT_USER, - mediator, - }, -}) - .then(({ ClientApp }) => { - loadableReady(() => { - ReactDOM.hydrate(, document.getElementById("react-root")) - }) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/collect/fixtures/categories.json b/src/desktop/apps/collect/fixtures/categories.json deleted file mode 100644 index 99df17770f8..00000000000 --- a/src/desktop/apps/collect/fixtures/categories.json +++ /dev/null @@ -1,460 +0,0 @@ -{ - "global": [ - { - "id": "abstract-art", - "name": "Abstract", - "image": "images/abstract.jpg" - }, - { - "id": "animals", - "name": "Animals", - "image": "images/animals.jpg" - }, - { - "id": "art-and-technology", - "name": "Technology", - "image": "images/technology.jpg" - }, - { - "id": "figurative-art", - "name": "Figurative", - "image": "images/figurative.jpg" - }, - { - "id": "gender", - "name": "Gender & Sexuality", - "image": "images/gender.jpg" - }, - { - "id": "geometric", - "name": "Geometric", - "image": "images/geometric.jpg" - }, - { - "id": "landscapes-and-waterscapes", - "name": "Landscape", - "image": "images/landscape.jpg" - }, - { - "id": "pop-and-contemporary-pop", - "name": "Pop", - "image": "images/pop.jpg" - }, - { - "id": "portrait", - "name": "Portraiture", - "image": "images/portrait.jpg" - }, - { - "id": "still-life", - "name": "Still Life", - "image": "images/stilllife.jpg" - } - ], - "photography": [ - { - "id": "abstract-art", - "name": "Abstract" - }, - { - "id": "fashion-photography", - "name": "Fashion" - }, - { - "id": "architecture-in-art", - "name": "Architecture" - }, - { - "id": "black-and-white", - "name": "Black" - }, - { - "id": "celebrity", - "name": "Celebrity" - }, - { - "id": "emerging-art", - "name": "Emerging" - }, - { - "id": "landscapes-and-waterscapes", - "name": "Landscape" - }, - { - "id": "modern-photography", - "name": "Modern Photography" - }, - { - "id": "portrait", - "name": "Portraiture" - }, - { - "id": "topographic-photography", - "name": "Topographic" - } - ], - "sculpture": [ - { - "id": "abstract-art", - "name": "Abstract", - "image": "images/abstract.jpg" - }, - { - "id": "traditional-arts-of-africa-oceania-and-the-americas", - "name": "Tribal Art", - "image": "images/abstract.jpg" - }, - { - "id": "biomorphic", - "name": "Biomorphic", - "image": "images/abstract.jpg" - }, - { - "id": "ceramic", - "name": "Ceramics", - "image": "images/abstract.jpg" - }, - { - "id": "emerging-art", - "name": "Emerging Artists", - "image": "images/abstract.jpg" - }, - { - "id": "found-objects-and-common-materials", - "name": "Found & Common Materials", - "image": "images/abstract.jpg" - }, - { - "id": "installation", - "name": "Installation Art", - "image": "images/abstract.jpg" - }, - { - "id": "light-art", - "name": "Light Art", - "image": "images/abstract.jpg" - }, - { - "id": "minimalism-and-contemporary-minimalist", - "name": "Minimalist", - "image": "images/abstract.jpg" - }, - { - "id": "textile-arts", - "name": "Textile Arts", - "image": "images/abstract.jpg" - } - ], - "prints": [ - { - "id": "artists-books", - "name": "Artists’ Books", - "image": "images/abstract.jpg" - }, - { - "id": "pop-and-contemporary-pop", - "name": "Pop", - "image": "images/abstract.jpg" - }, - { - "id": "emerging-art", - "name": "Emerging", - "image": "images/abstract.jpg" - }, - { - "id": "etching-slash-engraving", - "name": "Etchings & Intaglio", - "image": "images/abstract.jpg" - }, - { - "id": "geometric-abstraction", - "name": "Geometric", - "image": "images/abstract.jpg" - }, - { - "id": "lithograph-1", - "name": "Lithographs", - "image": "images/abstract.jpg" - }, - { - "id": "modern-and-impressionist-prints", - "name": "Modern & Impressionist", - "image": "images/abstract.jpg" - }, - { - "id": "silkscreen-1", - "name": "Silkscreen", - "image": "images/abstract.jpg" - }, - { - "id": "ukiyo-e", - "name": "Japanese Woodblock", - "image": "images/abstract.jpg" - }, - { - "id": "woodcut-and-linocut", - "name": "Woodcut & Linocut", - "image": "images/abstract.jpg" - } - ], - "work-on-paper": [ - { - "id": "abstract-art", - "name": "Abstract", - "image": "images/abstract.jpg" - }, - { - "id": "black-and-white", - "name": "Black & White", - "image": "images/abstract.jpg" - }, - { - "id": "collage", - "name": "Collage", - "image": "images/abstract.jpg" - }, - { - "id": "pop-and-contemporary-pop", - "name": "Pop", - "image": "images/abstract.jpg" - }, - { - "id": "drawing", - "name": "Drawing", - "image": "images/abstract.jpg" - }, - { - "id": "emerging-art", - "name": "Emerging Artists", - "image": "images/abstract.jpg" - }, - { - "id": "human-figure", - "name": "Human Figure", - "image": "images/abstract.jpg" - }, - { - "id": "modern-slash-impressionist-art", - "name": "Modern & Impressionist", - "image": "images/abstract.jpg" - }, - { - "id": "pastel", - "name": "Pastels", - "image": "images/abstract.jpg" - }, - { - "id": "watercolor", - "name": "Watercolors", - "image": "images/abstract.jpg" - } - ], - "film-slash-video": [ - { - "id": "animation", - "name": "Animation", - "image": "images/abstract.jpg" - }, - { - "id": "cinematic", - "name": "Cinematic", - "image": "images/abstract.jpg" - }, - { - "id": "contemporary-conceptualism", - "name": "Conceptual", - "image": "images/abstract.jpg" - }, - { - "id": "cultural-commentary", - "name": "Cultural Commentary", - "image": "images/abstract.jpg" - }, - { - "id": "digital-art", - "name": "Digital Art", - "image": "images/abstract.jpg" - }, - { - "id": "feminist-art-and-contemporary-feminist", - "name": "Feminist", - "image": "images/abstract.jpg" - }, - { - "id": "installation", - "name": "Installation Art", - "image": "images/abstract.jpg" - }, - { - "id": "interactive", - "name": "Interactive", - "image": "images/abstract.jpg" - }, - { - "id": "performance-art", - "name": "Performance", - "image": "images/abstract.jpg" - }, - { - "id": "post-internet-art", - "name": "Post-Internet", - "image": "images/abstract.jpg" - } - ], - "design": [ - { - "id": "20th-century-art", - "name": "20th Century", - "image": "images/abstract.jpg" - }, - { - "id": "ceramic", - "name": "Ceramics", - "image": "images/abstract.jpg" - }, - { - "id": "contemporary-design", - "name": "Contemporary", - "image": "images/abstract.jpg" - }, - { - "id": "emerging-design", - "name": "Emerging Designers", - "image": "images/abstract.jpg" - }, - { - "id": "furniture", - "name": "Furniture", - "image": "images/abstract.jpg" - }, - { - "id": "glass-objects", - "name": "Glass Objects", - "image": "images/abstract.jpg" - }, - { - "id": "lighting", - "name": "Lighting", - "image": "images/abstract.jpg" - }, - { - "id": "seating", - "name": "Seating", - "image": "images/abstract.jpg" - }, - { - "id": "table", - "name": "Tables", - "image": "images/abstract.jpg" - }, - { - "id": "textile-arts", - "name": "Textiles", - "image": "images/abstract.jpg" - } - ], - "jewelry": [ - { - "id": "brooches", - "name": "Brooches", - "image": "images/abstract.jpg" - }, - { - "id": "contemporary-jewelry", - "name": "Contemporary", - "image": "images/abstract.jpg" - }, - { - "id": "gemstone", - "name": "Gemstones", - "image": "images/abstract.jpg" - }, - { - "id": "geometric", - "name": "Geometric", - "image": "images/abstract.jpg" - }, - { - "id": "gold", - "name": "Gold", - "image": "images/abstract.jpg" - }, - { - "id": "jewelry-by-painters-and-sculptors", - "name": "Artist Jewelry", - "image": "images/abstract.jpg" - }, - { - "id": "modern-jewelry", - "name": "Modern", - "image": "images/abstract.jpg" - }, - { - "id": "necklaces", - "name": "Necklaces", - "image": "images/abstract.jpg" - }, - { - "id": "rings", - "name": "Rings", - "image": "images/abstract.jpg" - }, - { - "id": "silver", - "name": "Silver", - "image": "images/abstract.jpg" - } - ], - "painting": [ - { - "id": "abstract-art", - "name": "Abstract Art", - "image": "images/abstract.jpg" - }, - { - "id": "pop-and-contemporary-pop", - "name": "Pop", - "image": "images/abstract.jpg" - }, - { - "id": "gemstone", - "name": "Emerging Painters", - "image": "images/abstract.jpg" - }, - { - "id": "figurative-painting", - "name": "Figurative", - "image": "images/abstract.jpg" - }, - { - "id": "graffiti-slash-street-art", - "name": "Street Art", - "image": "images/abstract.jpg" - }, - { - "id": "hyperrealism", - "name": "Hyperrealism", - "image": "images/abstract.jpg" - }, - { - "id": "east-asian-ink-and-wash-painting", - "name": "Ink & Wash", - "image": "images/abstract.jpg" - }, - { - "id": "landscapes-and-waterscapes", - "name": "Landscape", - "image": "images/abstract.jpg" - }, - { - "id": "portrait", - "name": "Portait", - "image": "images/abstract.jpg" - }, - { - "id": "still-life", - "name": "Still Life", - "image": "images/abstract.jpg" - } - ] -} diff --git a/src/desktop/apps/collect/meta.tsx b/src/desktop/apps/collect/meta.tsx deleted file mode 100644 index 0a4caec03af..00000000000 --- a/src/desktop/apps/collect/meta.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React, { Fragment } from "react" - -interface Props { - appUrl: string - headTags: JSX.Element[] -} - -export const Meta = (props: Props) => { - const { headTags } = props - - return ( - - {headTags} - - - - - ) -} diff --git a/src/desktop/apps/collect/server.tsx b/src/desktop/apps/collect/server.tsx deleted file mode 100644 index 73669e44af7..00000000000 --- a/src/desktop/apps/collect/server.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/buildServerApp" -import { stitch } from "@artsy/stitch" -import { collectRoutes } from "v2/Apps/Collect/collectRoutes" -import express from "express" -import React from "react" -import { Meta } from "./meta" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import { skipIfClientSideRoutingEnabled } from "desktop/components/split_test/skipIfClientSideRoutingEnabled" - -export const app = express() - -const index = async (req, res, next) => { - try { - const { APP_URL, IS_MOBILE } = res.locals.sd - - const { - headTags, - bodyHTML, - redirect, - scripts, - styleTags, - status, - } = await buildServerApp({ - routes: collectRoutes, - url: req.url, - userAgent: req.header("User-Agent"), - context: buildServerAppContext(req, res), - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => , - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "collect", - bodyClass: IS_MOBILE ? "body-header-fixed body-no-margins" : null, - scripts, - styleTags, - }, - }) - - res.locals.PAGE_CACHE = { status, key: req.url, html: layout } - res.send(layout) - } catch (error) { - console.log(error) - next(error) - } -} - -app.get("/collect", skipIfClientSideRoutingEnabled, index) -app.get("/collect/:medium?", skipIfClientSideRoutingEnabled, index) -app.get("/collection/:slug", skipIfClientSideRoutingEnabled, index) -app.get("/collections", skipIfClientSideRoutingEnabled, index) diff --git a/src/desktop/apps/consign/client/__tests__/reducers.jest.ts b/src/desktop/apps/consign/client/__tests__/reducers.jest.ts index 8ed46ddb757..304b54ffa77 100644 --- a/src/desktop/apps/consign/client/__tests__/reducers.jest.ts +++ b/src/desktop/apps/consign/client/__tests__/reducers.jest.ts @@ -29,12 +29,12 @@ describe("Reducers", () => { describe("actions", () => { describe("setup", () => { it("returns the initial state", () => { - const { submissionFlow } = reducers(undefined, {}) + const { submissionFlow } = reducers(undefined, {} as any) submissionFlow.currentStep.should.eql("createAccount") }) it("passes URL queryParams into state", () => { - const initialState = reducers(undefined, {}) + const initialState = reducers(undefined, {} as any) expect(initialState.submissionFlow.contextPath).toEqual("foo") expect(initialState.submissionFlow.subject).toEqual("bar") }) @@ -44,7 +44,7 @@ describe("Reducers", () => { let initialResponse beforeEach(() => { - initialResponse = reducers(undefined, {}) + initialResponse = reducers(undefined, {} as any) }) describe("#updateSubmission", () => { @@ -293,7 +293,7 @@ describe("Reducers", () => { ) const scrubbedLocation = reducers( updatedAutocomplete, - actions.scrubLocation() + actions.scrubLocation() as any ) scrubbedLocation.submissionFlow.inputs.location_city.should.eql("") scrubbedLocation.submissionFlow.inputs.location_state.should.eql("") @@ -324,7 +324,7 @@ describe("Reducers", () => { ) const scrubbedLocation = reducers( updatedAutocomplete, - actions.scrubLocation() + actions.scrubLocation() as any ) scrubbedLocation.submissionFlow.inputs.location_city.should.eql("") scrubbedLocation.submissionFlow.inputs.location_state.should.eql( diff --git a/src/desktop/apps/consign/components/create_account/index.tsx b/src/desktop/apps/consign/components/create_account/index.tsx index e1408fc1dd1..f8fc397c542 100644 --- a/src/desktop/apps/consign/components/create_account/index.tsx +++ b/src/desktop/apps/consign/components/create_account/index.tsx @@ -6,7 +6,7 @@ import { handleSubmit } from "desktop/apps/authentication/helpers" import { ModalHeader } from "v2/Components/Modal/ModalHeader" import { updateAuthFormStateAndClearError } from "../../client/actions" import { ModalType } from "v2/Components/Authentication/Types" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" interface CreateAccountProps { contextPath: string diff --git a/src/desktop/apps/conversations/client.tsx b/src/desktop/apps/conversations/client.tsx deleted file mode 100644 index 454d52f6dfd..00000000000 --- a/src/desktop/apps/conversations/client.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { data as sd } from "sharify" -import { conversationRoutes } from "v2/Apps/Conversation/routes" -import React from "react" -import ReactDOM from "react-dom" -import { loadableReady } from "@loadable/component" - -const mediator = require("desktop/lib/mediator.coffee") - -buildClientApp({ - routes: conversationRoutes, - context: { - user: sd.CURRENT_USER, - mediator, - } as any, -}) - .then(({ ClientApp }) => { - loadableReady(() => { - ReactDOM.hydrate(, document.getElementById("react-root")) - }) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/conversations/server.tsx b/src/desktop/apps/conversations/server.tsx deleted file mode 100644 index 46bf050b532..00000000000 --- a/src/desktop/apps/conversations/server.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/server" -import { stitch } from "@artsy/stitch" -import { conversationRoutes } from "v2/Apps/Conversation/routes" -import React from "react" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import express, { Request, Response, NextFunction } from "express" - -export const app = express() - -app.get( - "/user/conversations*", - async (req: Request, res: Response, next: NextFunction) => { - try { - const { - bodyHTML, - redirect, - status, - headTags, - styleTags, - scripts, - } = await buildServerApp({ - context: buildServerAppContext(req, res), - routes: conversationRoutes, - url: req.url, - userAgent: req.header("User-Agent"), - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => {headTags}, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "conversations", - scripts, - styleTags, - }, - }) - - res.status(status).send(layout) - } catch (error) { - next(error) - } - } -) diff --git a/src/desktop/apps/editorial_features/components/gucci/components/nav/header.tsx b/src/desktop/apps/editorial_features/components/gucci/components/nav/header.tsx index 7ccaacab840..9a0b932657d 100644 --- a/src/desktop/apps/editorial_features/components/gucci/components/nav/header.tsx +++ b/src/desktop/apps/editorial_features/components/gucci/components/nav/header.tsx @@ -2,7 +2,7 @@ import styled from "styled-components" import React from "react" import Icon from "reaction/Components/Icon" import { PartnerInline } from "reaction/Components/Publishing/Partner/PartnerInline" -import { media, Flex, Sans, Serif } from "@artsy/palette" +import { Flex, Sans, Serif, media } from "@artsy/palette" import { Media } from "@artsy/reaction/dist/Utils/Responsive" interface HeaderProps { diff --git a/src/desktop/apps/editorial_features/components/gucci/components/nav/sections_nav.tsx b/src/desktop/apps/editorial_features/components/gucci/components/nav/sections_nav.tsx index 992bc221c7d..105a0868b9b 100644 --- a/src/desktop/apps/editorial_features/components/gucci/components/nav/sections_nav.tsx +++ b/src/desktop/apps/editorial_features/components/gucci/components/nav/sections_nav.tsx @@ -1,6 +1,6 @@ -import styled, { keyframes, css } from "styled-components" +import styled, { css, keyframes } from "styled-components" import React from "react" -import { color, Flex, Sans } from "@artsy/palette" +import { Flex, Sans, color } from "@artsy/palette" interface SectionsNavProps { animated?: boolean diff --git a/src/desktop/apps/editorial_features/components/gucci/components/section/section_text.tsx b/src/desktop/apps/editorial_features/components/gucci/components/section/section_text.tsx index 0bd7409e834..7e2687c4d5b 100644 --- a/src/desktop/apps/editorial_features/components/gucci/components/section/section_text.tsx +++ b/src/desktop/apps/editorial_features/components/gucci/components/section/section_text.tsx @@ -4,7 +4,7 @@ import styled from "styled-components" import { data as sd } from "sharify" import { Share } from "reaction/Components/Publishing/Byline/Share" import { Text } from "reaction/Components/Publishing" -import { Flex, Sans, space, media } from "@artsy/palette" +import { Flex, Sans, media, space } from "@artsy/palette" import { Media } from "@artsy/reaction/dist/Utils/Responsive" interface SectionTextProps { diff --git a/src/desktop/apps/editorial_features/components/gucci/components/section/section_video.tsx b/src/desktop/apps/editorial_features/components/gucci/components/section/section_video.tsx index fd4c3b1837b..d3cf0622cb7 100644 --- a/src/desktop/apps/editorial_features/components/gucci/components/section/section_video.tsx +++ b/src/desktop/apps/editorial_features/components/gucci/components/section/section_video.tsx @@ -3,7 +3,7 @@ import React from "react" import styled from "styled-components" import { unica } from "reaction/Assets/Fonts" import { Video } from "reaction/Components/Publishing" -import { media, Box, Flex, Sans } from "@artsy/palette" +import { Box, Flex, Sans, media } from "@artsy/palette" interface SectionVideoProps { section: any @@ -98,10 +98,7 @@ const SectionVideoContainer = styled(Box)` `}; ` -const VideoPreview = - styled.div < - { backgroundSrc: string } > - ` +const VideoPreview = styled.div<{ backgroundSrc: string }>` height: 59vw; max-height: 668px; position: relative; diff --git a/src/desktop/apps/editorial_features/components/gucci/components/series/series_footer.tsx b/src/desktop/apps/editorial_features/components/gucci/components/series/series_footer.tsx index cb67b91fc97..e42d14fa65c 100644 --- a/src/desktop/apps/editorial_features/components/gucci/components/series/series_footer.tsx +++ b/src/desktop/apps/editorial_features/components/gucci/components/series/series_footer.tsx @@ -1,6 +1,6 @@ import React from "react" -import { Text, PartnerBlock } from "reaction/Components/Publishing" -import { Flex, Box, Sans } from "@artsy/palette" +import { PartnerBlock, Text } from "reaction/Components/Publishing" +import { Box, Flex, Sans } from "@artsy/palette" import { Media } from "@artsy/reaction/dist/Utils/Responsive" interface SeriesFooterProps { diff --git a/src/desktop/apps/editorial_features/components/gucci/components/series/series_header.tsx b/src/desktop/apps/editorial_features/components/gucci/components/series/series_header.tsx index 16d8e94b348..fade5d40b93 100644 --- a/src/desktop/apps/editorial_features/components/gucci/components/series/series_header.tsx +++ b/src/desktop/apps/editorial_features/components/gucci/components/series/series_header.tsx @@ -1,4 +1,4 @@ -import { media, Box } from "@artsy/palette" +import { Box, media } from "@artsy/palette" import styled from "styled-components" import React from "react" import Waypoint from "react-waypoint" diff --git a/src/desktop/apps/experimental-app-shell/apps/artist/artistClient.tsx b/src/desktop/apps/experimental-app-shell/apps/artist/artistClient.tsx deleted file mode 100644 index 8324165ae52..00000000000 --- a/src/desktop/apps/experimental-app-shell/apps/artist/artistClient.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { setupArtistSignUpModal } from "desktop/apps/artist/components/cta" - -export const artistClient = () => { - setupArtistSignUpModal() -} diff --git a/src/desktop/apps/feature-reaction/client.tsx b/src/desktop/apps/feature-reaction/client.tsx deleted file mode 100644 index 040933316e4..00000000000 --- a/src/desktop/apps/feature-reaction/client.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { data as sd } from "sharify" -import { routes as featureRoutes } from "v2/Apps/Feature/routes" -import React from "react" -import ReactDOM from "react-dom" -import { loadableReady } from "@loadable/component" - -const mediator = require("desktop/lib/mediator.coffee") - -buildClientApp({ - routes: featureRoutes, - context: { - user: sd.CURRENT_USER, - mediator, - }, -}) - .then(({ ClientApp }) => { - loadableReady(() => { - ReactDOM.hydrate(, document.getElementById("react-root")) - }) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/feature-reaction/server.tsx b/src/desktop/apps/feature-reaction/server.tsx deleted file mode 100644 index 58776612b69..00000000000 --- a/src/desktop/apps/feature-reaction/server.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/server" -import { stitch } from "@artsy/stitch" -import { routes as featureRoutes } from "v2/Apps/Feature/routes" -import React from "react" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import express, { Request, Response, NextFunction } from "express" - -export const app = express() - -app.get( - "/feature*", - async (req: Request, res: Response, next: NextFunction) => { - try { - const { - bodyHTML, - redirect, - status, - headTags, - styleTags, - scripts, - } = await buildServerApp({ - context: buildServerAppContext(req, res), - routes: featureRoutes, - url: req.url, - userAgent: req.header("User-Agent"), - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => {headTags}, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "feature-reaction", - scripts, - styleTags, - }, - }) - - res.status(status).send(layout) - } catch (error) { - next(error) - } - } -) diff --git a/src/desktop/apps/feature/client/index.coffee b/src/desktop/apps/feature/client/index.coffee deleted file mode 100644 index 5b263b9da46..00000000000 --- a/src/desktop/apps/feature/client/index.coffee +++ /dev/null @@ -1,8 +0,0 @@ -{ FEATURE, TAB } = require('sharify').data -Feature = require '../../../models/feature.coffee' -FeatureView = require './view.coffee' - -module.exports.init = -> - feature = new Feature FEATURE - - new FeatureView el: $('#feature'), model: feature, tab: TAB diff --git a/src/desktop/apps/feature/client/view.coffee b/src/desktop/apps/feature/client/view.coffee deleted file mode 100644 index 60f82120088..00000000000 --- a/src/desktop/apps/feature/client/view.coffee +++ /dev/null @@ -1,93 +0,0 @@ -_ = require 'underscore' -Backbone = require 'backbone' -Artworks = require '../../../collections/artworks.coffee' -ShareView = require '../../../components/share/view.coffee' -SaleArtworkView = require '../../../components/artwork_item/views/sale_artwork.coffee' -ArtworkColumnsView = require '../../../components/artwork_columns/view.coffee' -artworkColumns = -> require('../../../components/artwork_columns/template.jade') arguments... -setsTemplate = -> require('../templates/sets.jade') arguments... -{ openAuthModal } = require '../../../lib/openAuthModal' -{ ModalType } = require "../../../../v2/Components/Authentication/Types" -{ Intent } = require "@artsy/cohesion" - -module.exports = class FeatureView extends Backbone.View - initialize: (options = {}) -> - # Make the sale available as soon as possible - @model.on 'change:sale', => - @sale = @model.get 'sale' - if @isAuction() - # Redirect to the dedicated auction pages - @redirectToAuction() - - @model.fetchSets - setsSuccess: (sets) => - @$('#feature-sets-container').html setsTemplate(sets: sets) - artworkPageSuccess: @artworkPageSuccess - artworksSuccess: @doneFetchingSaleArtworks - - @setupShareButtons() - - redirectToAuction: -> - if @isAuction() - window.location = @sale.href() # Redirect to the dedicated auction pages - - artworkPageSuccess: (fullCollection, newSaleArtworks) => - return if @sale?.isAuction() - - artworks = Artworks.fromSale(new Backbone.Collection newSaleArtworks) - - # Setup setup the columns view - unless @artworkColumns? - @artworkColumns = new ArtworkColumnsView - el: @$('#feature-artworks') - collection: new Artworks - displayPurchase: true - setHeight: 400 - gutterWidth: 0 - showBlurbs: true - isAuction: false - context_page: 'Feature page' - - # Always append - @appendArtworks artworks - - isAuction: => - @sale?.isAuction() - - doneFetchingSaleArtworks: (saleFeaturedSet) -> - artworks = saleFeaturedSet.get 'data' - - appendArtworks: (artworks) -> - @artworkColumns.appendArtworks artworks.models - @setupSaleArtworks artworks, @sale - - setupCurrentUser: -> - @currentUser = CurrentUser.orNull() - @currentUser?.initializeDefaultArtworkCollection() - @artworkCollection = @currentUser?.defaultArtworkCollection() - - setupSaleArtworks: (artworks, sale) -> - artworks.each (artwork) => - new SaleArtworkView - currentUser: @currentUser - el: @$(".artwork-item[data-artwork='#{artwork.id}']") - model: artwork - sale: sale - context_page: 'Feature page' - - if @artworkCollection - @artworkCollection.addRepoArtworks artworks - @artworkCollection.syncSavedArtworks() - - setupShareButtons: -> - new ShareView el: @$('.js-feature-share') - - authOrPass: (e) => - # FIXME: Maybe not used? - unless @currentUser - e.preventDefault() - openAuthModal(ModalType.signup, { - intent: Intent.bid - copy: 'Sign up to bid on artworks' - redirectTo: @sale.registerUrl() - }) diff --git a/src/desktop/apps/feature/index.coffee b/src/desktop/apps/feature/index.coffee deleted file mode 100644 index 7a68ab604f8..00000000000 --- a/src/desktop/apps/feature/index.coffee +++ /dev/null @@ -1,14 +0,0 @@ -# -# /feature -# - -express = require 'express' -routes = require './routes' - -app = module.exports = express() -app.set 'views', __dirname -app.set 'view engine', 'jade' - -app.get '/feature/city-guide*', routes.redirectCityGuide -app.get '/feature/:id', routes.index -app.get '/feature/:id/:tab', routes.index diff --git a/src/desktop/apps/feature/index.styl b/src/desktop/apps/feature/index.styl deleted file mode 100644 index fb22185a9f4..00000000000 --- a/src/desktop/apps/feature/index.styl +++ /dev/null @@ -1,161 +0,0 @@ -.feature-page - &.has-image - .feature-content - margin-top 60px - margin-bottom 120px - // Auction-specific header display - &[data-type='auction'] - .feature-title - .feature-description - margin-left 0 - padding-left 0 - text-align left - .feature-description - padding-right 80px - .feature-primary-information - .feature-metadata - float left - .feature-primary-information - width 75% - .feature-metadata - display block - width 25% - -.feature-image - background-position center center - background-repeat no-repeat - background-size cover - height 300px - margin 0 - width 100% - @media screen and (max-height: 768px) - height 200px - -.feature-header - margin 40px auto - position relative - clearfix() - -.feature-title - padding 0 80px - font-size 36px - line-height 1.25 - text-align center - -.feature-metadata - display none - -.feature-auction-register-button - margin 30px 0 - -.feature-auction-clock > .clock - text-align left - -.feature-share - position absolute - top 0 - right 0 - > .share-to-pinterest - display none - -.feature-content - position relative - margin-top 100px - margin-bottom @margin-top - -.feature-description - margin 30px 40px - font-size 22px - line-height 1.25 - text-align center - p - margin 20px 0 - a - fine-faux-underline() - -#feature-sets-container - position relative - min-height 200px - -.feature-set - border-bottom 1px solid gray-color - margin-bottom 35px - text-align center - &:last-child - border-bottom none - &:empty - display none -.feature-set-title - font-size 30px - margin-bottom 30px -.feature-set-description - font-size 22px - margin-bottom 30px - line-height 133% -.feature-set-item - display inline-block - margin 0 - overflow hidden - vertical-align top - a - text-decoration none -.feature-set-item-image-link - margin 0 0 14px 0 -.feature-set-item-full - width 100% -.feature-set-item-half - margin 0 1.5% - width 47% - .feature-set-item-caption - > * - margin-left auto - margin-right auto - width 75% - h1 - font-size 30px - line-height 1.3 - margin-bottom 19px -.feature-set-item-third - margin 0 1% - width 31% - -// models/mixins/layout_style supports 'fifth' and 'sixth' size -// layouts but this layout does not so we make them all quarter-size -.feature-set-item-quarter -.feature-set-item-fifth -.feature-set-item-sixth - margin 0 1% - width 22.8% - .feature-set-item-caption - text-align left -.feature-set-item-caption - margin-bottom 21px - text-align center - .feature-set-item-caption-heading - font-size 21px - line-height 1.15 - &:empty - display none - .feature-set-item-caption-subheading - color gray-darker-color - a - color gray-darker-color - &:empty - display none - -#feature-artworks - .artwork-item-caption p - .artwork-item-caption p a - color black - font-size 17px - .artwork-item-caption .artwork-item-artist - font-size 28px - margin-bottom 13px - display inline-block - margin-top 10px - font-weight normal - max-width 100% - a - font-size 28px - .artwork-item-partner - display none diff --git a/src/desktop/apps/feature/routes.coffee b/src/desktop/apps/feature/routes.coffee deleted file mode 100644 index 6752d541be0..00000000000 --- a/src/desktop/apps/feature/routes.coffee +++ /dev/null @@ -1,16 +0,0 @@ -Feature = require '../../models/feature.coffee' - -@index = (req, res, next) -> - new Feature(id: req.params.id).fetch - error: res.backboneError - success: (feature) -> - if feature.has('version') && feature.get('version') > 1 - next() - else - res.locals.sd.FEATURE = feature - res.locals.sd.TAB = req.params.tab - res.render 'templates/index', - feature: feature - -@redirectCityGuide = (req, res) -> - res.redirect 301, 'https://iphone.artsy.net' diff --git a/src/desktop/apps/feature/templates/featured_links.jade b/src/desktop/apps/feature/templates/featured_links.jade deleted file mode 100644 index 0d133ecad0d..00000000000 --- a/src/desktop/apps/feature/templates/featured_links.jade +++ /dev/null @@ -1,21 +0,0 @@ -mixin featuredLinks(items) - for item in items - figure( class="feature-set-item feature-set-item-#{item.layoutStyle(items.length)}" ) - if item.has('href') && item.hasImageForLayout(items.length) - a.feature-set-item-image-link.hoverable-image-link( href=item.get('href') ) - img.feature-set-item-image( src=item.imageUrlForLayout(items.length) ) - else if item.hasImageForLayout(items.length) - img.feature-set-item-image( src=item.imageUrlForLayout(items.length) ) - figcaption.feature-set-item-caption - if item.has('title') - h3.feature-set-item-caption-heading - if item.has('href') - a( href=item.get('href') )!= item.mdToHtml('title') - else - != item.mdToHtml('title') - if item.get('subtitle') - h4.feature-set-item-caption-subheading - if item.get('href') - a( href=item.get('href') )!= item.mdToHtml('subtitle') - else - != item.mdToHtml('subtitle') diff --git a/src/desktop/apps/feature/templates/index.jade b/src/desktop/apps/feature/templates/index.jade deleted file mode 100644 index 78d6a8e90ff..00000000000 --- a/src/desktop/apps/feature/templates/index.jade +++ /dev/null @@ -1,33 +0,0 @@ -extends ../../../components/main_layout/templates/index -include ../../../components/share/mixin - -block head - include meta - -append locals - - assetPackage = 'misc' - - bodyClass = bodyClass + ' body-no-margins' - -block body - - hasImage = feature.hasImage() && feature.imageUrl() - #feature.feature-page( class= hasImage ? 'has-image' : undefined ) - if hasImage - .feature-image( style="background-image: url(#{feature.imageUrl('wide')})" ) - - .responsive-layout-container: .main-layout-container.feature-content - header.feature-header - .feature-primary-information - h1.feature-title - = feature.get('name') - - if feature.get('description') - .feature-description - != feature.mdToHtml('description') - - .feature-metadata.js-feature-metadata - //- Rendered client-side - - //- nav.feature-share.js-feature-share - //- +share(feature.shareTitle()) - - #feature-sets-container: .loading-spinner diff --git a/src/desktop/apps/feature/templates/meta.jade b/src/desktop/apps/feature/templates/meta.jade deleted file mode 100644 index b48b29eee77..00000000000 --- a/src/desktop/apps/feature/templates/meta.jade +++ /dev/null @@ -1,17 +0,0 @@ -if sd.CURRENT_PATH == '/feature/collect-with-artsy' - - var description = 'Find everything you ever wanted to know about collecting art but were too afraid to ask, including tips on collecting and stories from art collectors.' -else - - var description = feature.toPageDescription() -title=feature.toPageTitle() -meta( property="og:title", content=feature.toPageTitle() ) -meta( name="description", content= description ) -meta( property="og:description", content= description ) -meta( property="twitter:description", content= description ) -link( rel="canonical", href="#{sd.APP_URL}#{feature.href()}" ) - -meta( property="og:url", content="#{sd.APP_URL}#{feature.href()}" ) -if feature.hasImage('large_rectangle') - meta( property="og:image", content=feature.imageUrl('large_rectangle') ) -meta( property="og:type", content="website" ) -meta( property="twitter:card", content="summary" ) -meta( name='fragment', content='!' ) diff --git a/src/desktop/apps/feature/templates/sets.jade b/src/desktop/apps/feature/templates/sets.jade deleted file mode 100644 index 8c51925d6cd..00000000000 --- a/src/desktop/apps/feature/templates/sets.jade +++ /dev/null @@ -1,16 +0,0 @@ -include ./featured_links -include ./videos - -for set in sets - section.feature-set - if set.get('name') - h2.feature-set-title!= set.mdToHtml('name') - if set.get('description') - h3.feature-set-description!= set.mdToHtml('description', { sanitize: false }) - case set.get('type') - when 'artworks' - #feature-artworks.artwork-columns-sale - when 'featured links' - +featuredLinks(set.models()) - when 'video' - +videosTemplate(set.models()) diff --git a/src/desktop/apps/feature/templates/videos.jade b/src/desktop/apps/feature/templates/videos.jade deleted file mode 100644 index 8bb77a62a3b..00000000000 --- a/src/desktop/apps/feature/templates/videos.jade +++ /dev/null @@ -1,36 +0,0 @@ -mixin videoTemplate(video, posterSize) - if video.has('subtitle') - .feature-set-video-caption!= video.mdToHtml('subtitle') - else - video( - data-id=video.get('id') - preload='auto' - poster=video.posterUrl(posterSize) - width='100%' - height='100%' - ) - for ext in video.get('video_extensions') - source( src=video.srcUrl(ext) ) - -mixin videosTemplate(videos) - for video in videos - case video.layoutStyle(videos.length) - when "full" - .feature-set-video.feature-set-video-full( data-id=video.get('id') ) - .video-triggers - .video-play-trigger - .video-play-arrow ► - .video-play-label Watch the video - .video-skip-trigger - .video-skip-arrow ▼ - .video-skip-label See the works - +videoTemplate(video, 'large_cinematic') - when "half" - .feature-set-video.feature-set-video-half( data-id=video.get('id') ) - +videoTemplate(video, 'large_cinematic') - when "third" - .feature-set-video.feature-set-video-third( data-id=video.get('id') ) - +videoTemplate(video, 'large_cinematic') - when "quarter" - .feature-set-video.feature-set-video-quarter( data-id=video.get('id') ) - +videoTemplate(video, 'medium_rectangle') diff --git a/src/desktop/apps/feature/test/client/index.test.coffee b/src/desktop/apps/feature/test/client/index.test.coffee deleted file mode 100644 index ca488288804..00000000000 --- a/src/desktop/apps/feature/test/client/index.test.coffee +++ /dev/null @@ -1,91 +0,0 @@ -_ = require 'underscore' -benv = require 'benv' -Backbone = require 'backbone' -sinon = require 'sinon' -Artwork = require '../../../../models/artwork.coffee' -SaleArtwork = require '../../../../models/sale_artwork.coffee' -Artworks = require '../../../../collections/artworks.coffee' -Feature = require '../../../../models/feature.coffee' -Sale = require '../../../../models/sale.coffee' -{ stubChildClasses } = require '../../../../test/helpers/stubs' -{ resolve } = require 'path' -{ fabricate } = require '@artsy/antigravity' - -describe 'FeatureView', -> - before (done) -> - benv.setup => - benv.expose { $: benv.require 'jquery' } - Backbone.$ = $ - @FeatureView = mod = benv.requireWithJadeify( - (resolve __dirname, '../../client/view'), - ['setsTemplate', 'artworkColumns'] - ) - stubChildClasses @FeatureView, @, ['ArtworkColumnsView'], ['appendArtworks', 'rebalance', 'undelegateEvents'] - @FeatureView.__set__ 'SaleArtworkView', (@saleArtworkViewStub = sinon.stub()) - done() - - after -> - benv.teardown() - - beforeEach (done) -> - sinon.stub Backbone, 'sync' - @feature = new Feature fabricate 'feature' - - benv.render resolve(__dirname, '../../templates/index.jade'), { - feature: @feature - sd: { FEATURE: @feature } - asset: (->) - }, => - @view = new @FeatureView - model: @feature - el: $ 'body' - - done() - - afterEach -> - Backbone.sync.restore() - - describe '#initialize', -> - - it 'sale without artworks', -> - sale = new Sale(fabricate 'sale') - _.last(Backbone.sync.args)[2].success([fabricate 'set', name: 'Explore this bidness', id: 'abc', item_type: 'Sale']) - _.last(Backbone.sync.args)[2].success(sale) - _.last(Backbone.sync.args)[2].success([]) - @view.sale.id.should.equal sale.id - @view.$el.html().should.containEql 'Explore this bidness' - - # Does not include artworks - @view.$('.artwork-columns-sale').is(':empty').should.be.true() - - it 'redirects when it is an auction', -> - redirectToAuction = sinon.spy @FeatureView::, 'redirectToAuction' - sale = new Sale fabricate 'sale', is_auction: true - _.last(Backbone.sync.args)[2].success [fabricate 'set', name: 'Explore this bidness', id: 'abc', item_type: 'Sale'] - _.last(Backbone.sync.args)[2].success sale - _.last(Backbone.sync.args)[2].success [] - @view.isAuction().should.be.true() - redirectToAuction.called.should.be.true() - redirectToAuction.restore() - - context 'sale with artworks', -> - beforeEach -> - @saleArtworks = [ - fabricate 'sale_artwork', { artwork: fabricate 'artwork', artist: fabricate 'artist', { name: 'Matthew Abbott', sortable_id: 'abbott-matthew' } } - fabricate 'sale_artwork', { artwork: fabricate 'artwork', artist: fabricate 'artist', { name: 'Leo Da Vinci', sortable_id: 'da-vinci-leo' } } - fabricate 'sale_artwork', { artwork: fabricate 'artwork', artist: false } - ] - - @callCount = @saleArtworkViewStub.callCount - - @sale = new Sale(fabricate 'sale') - _.last(Backbone.sync.args)[2].success([fabricate 'set', name: 'Explore this bidness', id: 'abc', item_type: 'Sale']) - _.last(Backbone.sync.args)[2].success(@sale) - _.last(Backbone.sync.args)[2].success(@saleArtworks) - _.last(Backbone.sync.args)[2].success([]) - - it 'renders without errors', -> - @saleArtworkViewStub.callCount.should.equal @callCount + @saleArtworks.length - - @view.sale.id.should.equal @sale.id - @view.$el.html().should.containEql 'Explore this bidness' diff --git a/src/desktop/apps/feature/test/routes.test.coffee b/src/desktop/apps/feature/test/routes.test.coffee deleted file mode 100644 index 624110e4fd1..00000000000 --- a/src/desktop/apps/feature/test/routes.test.coffee +++ /dev/null @@ -1,48 +0,0 @@ -_ = require 'underscore' -routes = require '../routes' -sinon = require 'sinon' -Backbone = require 'backbone' -{ fabricate } = require '@artsy/antigravity' - -describe '#index', -> - - beforeEach -> - sinon.stub Backbone, 'sync' - @req = { params: { id: 'awesome-feature' } } - @res = - render: sinon.stub() - redirect: sinon.stub() - locals: - sd: - API_URL: 'http://localhost:5000' - @next = sinon.stub() - - afterEach -> - Backbone.sync.restore() - - it 'renders the feature page', -> - routes.index @req, @res, @next - Backbone.sync.args[0][2].success fabricate 'feature', name: 'Awesome Feature' - @res.render.args[0][0].should.equal 'templates/index' - @res.render.args[0][1].feature.get('name').should.equal 'Awesome Feature' - - it 'passes through the route if the version is too high', -> - routes.index @req, @res, @next - Backbone.sync.args[0][2].success fabricate 'feature', name: 'Awesome Feature', version: 2 - @next.calledOnce.should.be.ok() - -describe '#redirectCityGuide', -> - - beforeEach -> - sinon.stub Backbone, 'sync' - @req = { params: { id: 'city-guide-foo' } } - @res = - redirect: sinon.stub() - - afterEach -> - Backbone.sync.restore() - - it 'redirects to iphone splash page', -> - routes.redirectCityGuide @req, @res - @res.redirect.args[0][0].should.eql(301) - @res.redirect.args[0][1].should.eql('https://iphone.artsy.net') diff --git a/src/desktop/apps/feature/test/templates/featured_links.test.coffee b/src/desktop/apps/feature/test/templates/featured_links.test.coffee deleted file mode 100644 index 978b01a0c04..00000000000 --- a/src/desktop/apps/feature/test/templates/featured_links.test.coffee +++ /dev/null @@ -1,69 +0,0 @@ -_ = require 'underscore' -jade = require 'jade' -path = require 'path' -fs = require 'fs' -benv = require 'benv' -{ fabricate } = require '@artsy/antigravity' -FeaturedSet = require '../../../../models/featured_set.coffee' -FeaturedLink = require '../../../../models/featured_link.coffee' -FeaturedLinks = require '../../../../collections/featured_links.coffee' - -render = (templateName) -> - filename = path.resolve __dirname, "../../templates/#{templateName}.jade" - jade.compile(fs.readFileSync(filename), filename: filename) - -describe 'Featured Links', -> - before (done) -> - benv.setup -> - benv.expose $: benv.require('jquery'), jQuery: benv.require('jquery') - done() - - after -> - benv.teardown() - - beforeEach -> - @sd = API_URL: 'http://localhost:5000' - @set = new FeaturedSet - owner: fabricate('feature', image_versions: ['wide']) - id: "52b347c59c18db5aef000208" - published: true - key: "1" - name: "Top 10 Posts" - item_type: "FeaturedLink" - type: "featured links" - owner_type: "Feature" - data: new FeaturedLinks [fabricate 'featured_link'] - - describe 'template', -> - it 'adds different layout classes depending on the size of the collection', -> - _(5).times (n) => - $html = $(render('sets')(sets: [@set])) - len = @set.get('data').length - featuredLink = @set.get('data').first() - $html.find('.feature-set-item').is(".feature-set-item-#{featuredLink.layoutStyle(len)}").should.be.true() - @set.get('data').add new FeaturedLink fabricate 'featured_link' - - it 'links elements if the model has an href attribute', -> - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-item').should.have.lengthOf 1 - $html.find('.feature-set-item a').should.have.lengthOf 3 - - it 'adds an image when the model has one', -> - @set.get('data').first().set 'image_versions', ['wide', 'large_rectangle', 'medium_rectangle'] - link = @set.get('data').first() - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-item img').should.have.lengthOf 1 - $html.find('.feature-set-item img').attr('src').should.equal link.imageUrlForLayout @set.get('data').length - - it 'does not link elements if the model has no href attribute', -> - @set.get('data').first().set 'href', null - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-item').should.have.lengthOf 1 - $html.find('.feature-set-item a').should.have.lengthOf 0 - - it 'renders a caption with heading and subheading if available', -> - link = @set.get('data').first() - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-item-caption').should.have.lengthOf 1 - $html.find('.feature-set-item-caption-heading').text().should.containEql link.get('title') - $html.find('.feature-set-item-caption-subheading').text().should.containEql link.get('subtitle') diff --git a/src/desktop/apps/feature/test/templates/index.test.coffee b/src/desktop/apps/feature/test/templates/index.test.coffee deleted file mode 100644 index 42162e8910e..00000000000 --- a/src/desktop/apps/feature/test/templates/index.test.coffee +++ /dev/null @@ -1,33 +0,0 @@ -benv = require 'benv' -Backbone = require 'backbone' -{ fabricate } = require '@artsy/antigravity' -{ resolve } = require 'path' -Feature = require '../../../../models/feature' - -describe 'Feature template', -> - before (done) -> - benv.setup => - benv.expose $: benv.require('jquery'), jQuery: benv.require('jquery') - @sd = API_URL: 'http://localhost:5000' - @feature = new Feature fabricate('feature', image_versions: ['wide']) - benv.render resolve(__dirname, '../../templates/index.jade'), { - sd: @sd - asset: (->) - feature: @feature - }, -> done() - - after -> - benv.teardown() - - describe 'template', -> - it 'renders a feature image', -> - $('.feature-image').should.have.lengthOf 1 - $('.feature-image').attr('style').should.containEql @feature.imageUrl('wide') - - it 'renders the feature title', -> - $('.feature-title').should.have.lengthOf 1 - $('.feature-title').text().should.equal @feature.get 'name' - - it 'renders the feature description', -> - $('.feature-description').should.have.lengthOf 1 - $('.feature-description').text().should.equal @feature.mdToHtmlToText 'description' diff --git a/src/desktop/apps/feature/test/templates/meta.test.coffee b/src/desktop/apps/feature/test/templates/meta.test.coffee deleted file mode 100644 index 6f636731dbe..00000000000 --- a/src/desktop/apps/feature/test/templates/meta.test.coffee +++ /dev/null @@ -1,26 +0,0 @@ -fs = require 'fs' -jade = require 'jade' -path = require 'path' -{ fabricate } = require '@artsy/antigravity' -Feature = require '../../../../models/feature' - -describe 'Meta tags', -> - - describe 'Feature', -> - - before -> - @sd = - APP_URL: "http://localhost:5000" - @file = "#{path.resolve __dirname, '../../'}/templates/meta.jade" - @feature = new Feature fabricate('feature') - @feature.href = -> '' - @html = jade.render fs.readFileSync(@file).toString(), - sd: @sd - feature: @feature - - it 'includes canonical url, twitter card, og tags, and title', -> - @html.should.containEql " - filename = path.resolve __dirname, "../../templates/#{templateName}.jade" - jade.compile(fs.readFileSync(filename), filename: filename) - -describe 'Featured Sets', -> - before (done) -> - benv.setup -> - benv.expose $: benv.require('jquery'), jQuery: benv.require('jquery') - done() - - after -> - benv.teardown() - - beforeEach -> - @sd = API_URL: 'http://localhost:5000' - @set = new FeaturedSet - owner: fabricate('feature', image_versions: ['wide']) - id: "52b347c59c18db5aef000208" - published: true - key: "1" - name: "The Best of 2013" - description: "From launching our [mobile app](//link-to-mobile-app) to bringing you fairs, features, and biennials from around the globe, 2013 was a big year at Artsy. Discover our highlights from the past year, and find out what we—and a few of our favorite influencers—think you should keep your eye on in 2014." - item_type: "FeaturedLink" - type: "featured links" - owner_type: "Feature" - - describe 'template', -> - it 'renders the name of the set', -> - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-title').should.have.lengthOf 1 - $html.find('.feature-set-title').text().should.containEql @set.get('name') - - it 'renders the set description if there is one', -> - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-description').should.have.lengthOf 1 - $html.find('.feature-set-description').text().should.equal @set.mdToHtmlToText 'description' - - it 'renders without a title or description', -> - @set.set description: null, name: null - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-title').should.have.lengthOf 0 - $html.find('.feature-set-description').should.have.lengthOf 0 - $html.is('.feature-set').should.be.true() - $html.is(':empty').should.be.true() - - describe "fetured links", -> - it 'renders a featured link', -> - @set.set 'data', new FeaturedLinks([ fabricate('featured_link')]) - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-item').should.have.lengthOf 1 - - describe "videos", -> - it 'renders videos', -> - @set.set 'data', new FeaturedLinks([ fabricate('featured_link')]) - $html = $(render('sets')(sets: [@set])) - $html.find('.feature-set-item').should.have.lengthOf 1 - - describe "sale artworks", -> - it 'renders sale artworks in an artwork column component', -> - @set.set 'type', 'artworks' - $html = $(render('sets')(sets: [@set])) - $html.find('#feature-artworks').should.have.lengthOf 1 diff --git a/src/desktop/apps/identity_verification/client.tsx b/src/desktop/apps/identity_verification/client.tsx deleted file mode 100644 index 7ab066cdace..00000000000 --- a/src/desktop/apps/identity_verification/client.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { data as sd } from "sharify" -import { loadableReady } from "@loadable/component" - -import { routes } from "v2/Apps/IdentityVerification/routes" -import React from "react" -import ReactDOM from "react-dom" - -buildClientApp({ - routes, - context: { - user: sd.CURRENT_USER, - }, -}) - .then(({ ClientApp }) => { - loadableReady(() => { - ReactDOM.hydrate(, document.getElementById("react-root")) - }) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/identity_verification/routes.tsx b/src/desktop/apps/identity_verification/routes.tsx deleted file mode 100644 index 4f9150d5156..00000000000 --- a/src/desktop/apps/identity_verification/routes.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/server" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import { routes } from "v2/Apps/IdentityVerification/routes" -import { stitch } from "@artsy/stitch" - -export const identityVerification = async (req, res, next) => { - if (!res.locals.sd.CURRENT_USER) { - return res.redirect( - `/login?redirectTo=${encodeURIComponent(req.originalUrl)}` - ) - } - try { - const { - bodyHTML, - redirect, - status, - headTags, - scripts, - styleTags, - } = await buildServerApp({ - routes, - url: req.url, - userAgent: req.header("User-Agent"), - context: buildServerAppContext(req, res), - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => headTags, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "identity_verification", - scripts, - styleTags, - }, - }) - - res.status(status).send(layout) - } catch (error) { - next(error) - } -} diff --git a/src/desktop/apps/identity_verification/server.ts b/src/desktop/apps/identity_verification/server.ts deleted file mode 100644 index e9a2a0c7c26..00000000000 --- a/src/desktop/apps/identity_verification/server.ts +++ /dev/null @@ -1,11 +0,0 @@ -import express from "express" -import { skipIfClientSideRoutingEnabled } from "desktop/components/split_test/skipIfClientSideRoutingEnabled" -import { identityVerification } from "desktop/apps/identity_verification/routes" - -export const app = express() - -app.get( - "/identity-verification/:id", - skipIfClientSideRoutingEnabled, - identityVerification -) diff --git a/src/desktop/apps/order/__tests__/routes.jest.js b/src/desktop/apps/order/__tests__/routes.jest.js deleted file mode 100644 index e1d7f26af06..00000000000 --- a/src/desktop/apps/order/__tests__/routes.jest.js +++ /dev/null @@ -1,85 +0,0 @@ -import { stitch } from "@artsy/stitch" -import { buildServerApp } from "v2/Artsy/Router/server" -import { checkoutFlow } from "../routes" - -jest.mock("@artsy/stitch", () => ({ - stitch: jest.fn(), -})) - -jest.mock("v2/Artsy/Router/server", () => ({ - buildServerApp: jest.fn(), -})) - -// FIXME: TypeError: Cannot read property 'orderID' of undefined -xdescribe("Request for order", () => { - let req - let res - let next - const sendMock = jest.fn() - - describe("/orders/:orderID", () => { - beforeEach(() => { - req = { - path: "/orders/123", - originalUrl: "/orders/123", - query: {}, - header: () => "referrer", - } - res = { - locals: { - sd: { - CURRENT_USER: null, - }, - }, - status: jest.fn(() => ({ send: sendMock })), - redirect: jest.fn(), - } - next = jest.fn() - stitch.mockReset() - buildServerApp.mockReset() - sendMock.mockReset() - }) - - it("redirects an unauthenticated user to log in", done => { - checkoutFlow(req, res, next).then(() => { - expect(res.redirect).toHaveBeenCalledWith( - "/login?redirectTo=%2Forders%2F123" - ) - done() - }) - }) - - it("permits an authenticated user access", done => { - res.locals.sd.CURRENT_USER = { - id: "user1234", - } - buildServerApp.mockResolvedValue({}) - - checkoutFlow(req, res, next).then(() => { - expect(res.redirect).not.toHaveBeenCalled() - expect(buildServerApp).toHaveBeenCalled() - done() - }) - }) - - it("serves a 404 when an order is not found", done => { - res.locals.sd.CURRENT_USER = { - id: "user1234", - } - buildServerApp.mockRejectedValue({ - message: "asdfadsfsda Received status code 404 adsfasd", - }) - - checkoutFlow(req, res, next).then(() => { - expect(buildServerApp).toHaveBeenCalled() - expect(next).toHaveBeenCalledWith( - expect.objectContaining({ - message: "Order Not Found", - status: 404, - }) - ) - done() - }) - }) - }) -}) diff --git a/src/desktop/apps/order/client.js b/src/desktop/apps/order/client.js deleted file mode 100644 index 1b58f48a5dd..00000000000 --- a/src/desktop/apps/order/client.js +++ /dev/null @@ -1,87 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { data as sd } from "sharify" -import { routes } from "v2/Apps/Order/routes" -import mediator from "desktop/lib/mediator.coffee" -import React from "react" -import ReactDOM from "react-dom" -import styled from "styled-components" -import User from "desktop/models/user.coffee" -import Artwork from "desktop/models/artwork.coffee" -import ArtworkInquiry from "desktop/models/artwork_inquiry.coffee" -import openInquiryQuestionnaireFor from "desktop/components/inquiry_questionnaire/index.coffee" -import { enableIntercom } from "lib/intercom" - -mediator.on("openOrdersContactArtsyModal", options => { - const artworkId = options.artworkId - if (artworkId) { - const user = User.instantiate() - const inquiry = new ArtworkInquiry({ notification_delay: 600 }) - const artwork = new Artwork({ id: artworkId }) - - artwork.fetch().then(() => { - openInquiryQuestionnaireFor({ - user, - artwork, - inquiry, - ask_specialist: true, - }) - }) - } -}) - -mediator.on("enableIntercomForBuyers", options => { - enableIntercom(options) -}) - -// Track page views for order checkout flow: shipping, payment and review. -// These events are triggered from Reaction. -const orderCheckoutFlowEvents = [ - "order:shipping", - "order:payment", - "order:review", - "order:status", -] -orderCheckoutFlowEvents.map(eventName => { - mediator.on(eventName, () => { - window.analytics.page( - { path: window.location.pathname }, - { integrations: { Marketo: false } } - ) - // Reset timers that track time on page since we're tracking each order - // checkout view as a separate page. - typeof window.desktopPageTimeTrackers !== "undefined" && - window.desktopPageTimeTrackers.forEach(tracker => { - // No need to reset the tracker if we're on the same page. - if (window.location.pathname !== tracker.path) - tracker.reset(window.location.pathname) - }) - }) -}) - -buildClientApp({ - routes, - context: { - user: sd.CURRENT_USER, - mediator, - isEigen: sd.EIGEN, - }, - history: { - options: { - useBeforeUnload: true, - }, - }, -}) - .then(({ ClientApp }) => { - ReactDOM.hydrate( - , - - document.getElementById("react-root") - ) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/order/routes.tsx b/src/desktop/apps/order/routes.tsx deleted file mode 100644 index 3aaf311074b..00000000000 --- a/src/desktop/apps/order/routes.tsx +++ /dev/null @@ -1,93 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/server" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import { routes } from "v2/Apps/Order/routes" -import { stitch } from "@artsy/stitch" -const metaphysics = require("lib/metaphysics.coffee") - -export const checkoutFlow = async (req, res, next) => { - if (!res.locals.sd.CURRENT_USER) { - return res.redirect( - `/login?redirectTo=${encodeURIComponent(req.originalUrl)}` - ) - } - try { - const { - bodyHTML, - redirect, - status, - headTags, - scripts, - styleTags, - } = await buildServerApp({ - routes, - url: req.url, - userAgent: req.header("User-Agent"), - context: buildServerAppContext(req, res), - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - const headerLogoHref = await getArtworkHref(req) - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: - "../../components/main_layout/templates/react_minimal_header.jade", - blocks: { - head: () => headTags, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "order", - // header logo should link back to originating artwork - headerLogoHref, - hideHeaderOnEigen: res.locals.sd.EIGEN, - options: { - stripev3: true, - }, - scripts, - styleTags, - }, - }) - - res.status(status).send(layout) - } catch (error) { - next(error) - } -} - -async function getArtworkHref(req) { - try { - const { order } = await metaphysics({ - query: OrderHeaderQuery(req.params.orderID), - req, - }) - return order.lineItems.edges[0].node.artwork.href - } catch (e) { - console.error(e) - return "/" - } -} - -function OrderHeaderQuery(orderId) { - return ` - query OrderHeaderQuery { - order(id: "${orderId}") { - id - lineItems { - edges { - node { - artwork { - href - } - } - } - } - } - }` -} diff --git a/src/desktop/apps/order/server.js b/src/desktop/apps/order/server.js deleted file mode 100644 index 6a833cefe19..00000000000 --- a/src/desktop/apps/order/server.js +++ /dev/null @@ -1,7 +0,0 @@ -import express from "express" -import { checkoutFlow } from "desktop/apps/order/routes" -import { skipIfClientSideRoutingEnabled } from "desktop/components/split_test/skipIfClientSideRoutingEnabled" - -export const app = express() - -app.get("/orders/:orderID*", skipIfClientSideRoutingEnabled, checkoutFlow) diff --git a/src/desktop/apps/purchases/client.tsx b/src/desktop/apps/purchases/client.tsx deleted file mode 100644 index b9056a30ed6..00000000000 --- a/src/desktop/apps/purchases/client.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { data as sd } from "sharify" -import { routes } from "v2/Apps/Purchase/routes" -import React from "react" -import ReactDOM from "react-dom" -import { setupArtistSignUpModal } from "desktop/apps/artist/components/cta" - -const mediator = require("desktop/lib/mediator.coffee") - -buildClientApp({ - routes, - context: { - user: sd.CURRENT_USER, - mediator, - } as any, -}) - .then(({ ClientApp }) => { - ReactDOM.hydrate( - , - document.getElementById("react-root"), - () => { - setupArtistSignUpModal() - } - ) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/purchases/server.tsx b/src/desktop/apps/purchases/server.tsx deleted file mode 100644 index dd697500a50..00000000000 --- a/src/desktop/apps/purchases/server.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/server" -import { stitch } from "@artsy/stitch" -import { routes } from "v2/Apps/Purchase/routes" -import React from "react" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import express, { Request, Response, NextFunction } from "express" - -export const app = express() - -app.get( - "/user/purchases", - async (req: Request, res: Response, next: NextFunction) => { - try { - const context = buildServerAppContext(req, res, {}) - const { - bodyHTML, - redirect, - status, - headTags, - styleTags, - scripts, - } = await buildServerApp({ - routes, - url: req.url, - userAgent: req.header("User-Agent"), - context, - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => {headTags}, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "purchases", - scripts, - styleTags, - }, - }) - - res.status(status).send(layout) - } catch (error) { - next(error) - } - } -) diff --git a/src/desktop/apps/search2/client.tsx b/src/desktop/apps/search2/client.tsx deleted file mode 100644 index c961bb842fd..00000000000 --- a/src/desktop/apps/search2/client.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { routes } from "v2/Apps/Search/routes" -import { data as sd } from "sharify" -import React from "react" -import ReactDOM from "react-dom" - -const mediator = require("desktop/lib/mediator.coffee") - -buildClientApp({ - routes, - context: { - user: sd.CURRENT_USER, - mediator, - }, -}) - .then(({ ClientApp }) => { - ReactDOM.hydrate(, document.getElementById("react-root")) - document.getElementById("loading-container").remove() - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/search2/server.tsx b/src/desktop/apps/search2/server.tsx deleted file mode 100644 index a0864300f06..00000000000 --- a/src/desktop/apps/search2/server.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { stitch } from "@artsy/stitch" -import express, { Request, Response, NextFunction } from "express" -import { stringify } from "querystring" -import { SearchResultsSkeleton } from "v2/Apps/Search/Components/SearchResultsSkeleton" -import React from "react" -import { StitchWrapper } from "desktop/components/react/stitch_components/StitchWrapper" -import { skipIfClientSideRoutingEnabled } from "desktop/components/split_test/skipIfClientSideRoutingEnabled" - -export const app = express() - -app.get( - "/search/:tab?", - skipIfClientSideRoutingEnabled, - async (req: Request, res: Response, next: NextFunction) => { - if (!req.query.term) { - if (req.query.q) { - const query = stringify({ term: req.query.q }) - res.locals.sd.searchQuery = req.query.q - res.redirect(302, `/search?${query}`) - return - } else { - res.redirect(302, "/") - return - } - } else { - res.locals.sd.searchQuery = req.query.term - } - try { - const layout = await stitch({ - basePath: __dirname, - layout: "templates/index.jade", - locals: { - ...res.locals, - assetPackage: "search2", - }, - blocks: { - loadingComponent: _props => { - return ( - - - - ) - }, - }, - }) - - res.send(layout) - } catch (error) { - next(error) - } - } -) diff --git a/src/desktop/apps/search2/templates/index.jade b/src/desktop/apps/search2/templates/index.jade deleted file mode 100644 index bfc1488d17c..00000000000 --- a/src/desktop/apps/search2/templates/index.jade +++ /dev/null @@ -1,9 +0,0 @@ -extends ../../../components/main_layout/templates/redesign - -append locals - - assetPackage = 'search2' - -block body - #react-root - #loading-container - != loadingComponent \ No newline at end of file diff --git a/src/desktop/apps/viewing-room/client.tsx b/src/desktop/apps/viewing-room/client.tsx deleted file mode 100644 index 4d4074ee39f..00000000000 --- a/src/desktop/apps/viewing-room/client.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { buildClientApp } from "v2/Artsy/Router/client" -import { data as sd } from "sharify" -import { routes as viewingRoomRoutes } from "v2/Apps/ViewingRoom/routes" -import React from "react" -import ReactDOM from "react-dom" -import { loadableReady } from "@loadable/component" - -const mediator = require("desktop/lib/mediator.coffee") - -buildClientApp({ - routes: viewingRoomRoutes, - context: { - user: sd.CURRENT_USER, - mediator, - }, -}) - .then(({ ClientApp }) => { - loadableReady(() => { - ReactDOM.hydrate(, document.getElementById("react-root")) - }) - }) - .catch(error => { - console.error(error) - }) - -if (module.hot) { - module.hot.accept() -} diff --git a/src/desktop/apps/viewing-room/server.tsx b/src/desktop/apps/viewing-room/server.tsx deleted file mode 100644 index 5b78c63862c..00000000000 --- a/src/desktop/apps/viewing-room/server.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { buildServerApp } from "v2/Artsy/Router/server" -import { stitch } from "@artsy/stitch" -import { routes as viewingRoomRoutes } from "v2/Apps/ViewingRoom/routes" -import React from "react" -import { buildServerAppContext } from "desktop/lib/buildServerAppContext" -import express, { Request, Response, NextFunction } from "express" -import { skipIfClientSideRoutingEnabled } from "desktop/components/split_test/skipIfClientSideRoutingEnabled" - -export const app = express() - -app.get( - "/viewing-room*", - skipIfClientSideRoutingEnabled, - async (req: Request, res: Response, next: NextFunction) => { - try { - const { - bodyHTML, - redirect, - status, - headTags, - styleTags, - scripts, - } = await buildServerApp({ - context: buildServerAppContext(req, res), - routes: viewingRoomRoutes, - url: req.url, - userAgent: req.header("User-Agent"), - }) - - if (redirect) { - res.redirect(302, redirect.url) - return - } - - // Render layout - const layout = await stitch({ - basePath: __dirname, - layout: "../../components/main_layout/templates/react_redesign.jade", - blocks: { - head: () => {headTags}, - body: bodyHTML, - }, - locals: { - ...res.locals, - assetPackage: "viewing-room", - scripts, - styleTags, - }, - }) - - res.status(status).send(layout) - } catch (error) { - next(error) - } - } -) diff --git a/src/desktop/assets/analytics.coffee b/src/desktop/assets/analytics.coffee index 20beedf7f33..ae3f3fe7422 100644 --- a/src/desktop/assets/analytics.coffee +++ b/src/desktop/assets/analytics.coffee @@ -45,18 +45,16 @@ trackEvent = (data) -> trackingData = _.omit data, 'action_type' trackingOptions = {} - # FIXME: Remove after A/B test ends - if sd.CLIENT_NAVIGATION_V5 == "experiment" - referrer = analytics.__artsyReferrer - # Grab referrer from our trackingMiddleware in Reaction, since we're in a - # single-page-app context and the value will need to be refreshed on route - # change. See: https://github.com/artsy/reaction/blob/master/src/Artsy/Analytics/trackingMiddleware.ts - if referrer - trackingOptions = { - page: { - referrer: referrer - } + referrer = analytics.__artsyReferrer + # Grab referrer from our trackingMiddleware in Reaction, since we're in a + # single-page-app context and the value will need to be refreshed on route + # change. See: https://github.com/artsy/reaction/blob/master/src/Artsy/Analytics/trackingMiddleware.ts + if referrer + trackingOptions = { + page: { + referrer: referrer } + } analytics.track data.action_type, trackingData, trackingOptions else diff --git a/src/desktop/assets/artist.js b/src/desktop/assets/artist.js deleted file mode 100644 index 35f587ae198..00000000000 --- a/src/desktop/assets/artist.js +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/artist/client" diff --git a/src/desktop/assets/artist.styl b/src/desktop/assets/artist.styl deleted file mode 100644 index 38366117f4d..00000000000 --- a/src/desktop/assets/artist.styl +++ /dev/null @@ -1,2 +0,0 @@ -.artist__foo - width: 100% diff --git a/src/desktop/assets/experimental-app-shell.styl b/src/desktop/assets/artsy-v2.styl similarity index 100% rename from src/desktop/assets/experimental-app-shell.styl rename to src/desktop/assets/artsy-v2.styl diff --git a/src/desktop/assets/artsy-v2.tsx b/src/desktop/assets/artsy-v2.tsx new file mode 100644 index 00000000000..c6f9451600a --- /dev/null +++ b/src/desktop/assets/artsy-v2.tsx @@ -0,0 +1 @@ +import "desktop/apps/artsy-v2/client" diff --git a/src/desktop/assets/artwork.js b/src/desktop/assets/artwork.js deleted file mode 100644 index 89b8f301a76..00000000000 --- a/src/desktop/assets/artwork.js +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/artwork/client" diff --git a/src/desktop/assets/auctions.coffee b/src/desktop/assets/auctions.coffee index 05e2647b939..9673bba13e5 100644 --- a/src/desktop/assets/auctions.coffee +++ b/src/desktop/assets/auctions.coffee @@ -28,7 +28,6 @@ routes = /auction-registration/.* /auction/.*/bid/.* /auction/.*/buyers-premium - /feature/.*/bid/.* ''': require('../apps/auction_support/client/index.coffee').init ''' diff --git a/src/desktop/assets/collect.styl b/src/desktop/assets/collect.styl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/desktop/assets/collect.ts b/src/desktop/assets/collect.ts deleted file mode 100644 index e6ddc3c2206..00000000000 --- a/src/desktop/assets/collect.ts +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/collect/client" diff --git a/src/desktop/assets/conversations.styl b/src/desktop/assets/conversations.styl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/desktop/assets/conversations.tsx b/src/desktop/assets/conversations.tsx deleted file mode 100644 index 5cd782417f5..00000000000 --- a/src/desktop/assets/conversations.tsx +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/conversations/client" diff --git a/src/desktop/assets/experimental-app-shell.tsx b/src/desktop/assets/experimental-app-shell.tsx deleted file mode 100644 index 5d4abb16711..00000000000 --- a/src/desktop/assets/experimental-app-shell.tsx +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/experimental-app-shell/client" diff --git a/src/desktop/assets/feature-reaction.tsx b/src/desktop/assets/feature-reaction.tsx deleted file mode 100644 index c291cfa08de..00000000000 --- a/src/desktop/assets/feature-reaction.tsx +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/feature-reaction/client" diff --git a/src/desktop/assets/identity_verification.styl b/src/desktop/assets/identity_verification.styl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/desktop/assets/identity_verification.ts b/src/desktop/assets/identity_verification.ts deleted file mode 100644 index d29090814f0..00000000000 --- a/src/desktop/assets/identity_verification.ts +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/identity_verification/client" diff --git a/src/desktop/assets/misc.coffee b/src/desktop/assets/misc.coffee index d3b309bcca7..2695a3fc8da 100644 --- a/src/desktop/assets/misc.coffee +++ b/src/desktop/assets/misc.coffee @@ -11,8 +11,6 @@ routes = '/contact': require('../apps/contact/client/index.coffee').init - '/feature': require('../apps/feature/client/index.coffee').init - '/jobs': require('../apps/jobs/client/index.coffee').init '/unsubscribe': require('../apps/unsubscribe/client/index.coffee').init diff --git a/src/desktop/assets/misc.styl b/src/desktop/assets/misc.styl index 6baf243233e..b2ff8b0b65b 100644 --- a/src/desktop/assets/misc.styl +++ b/src/desktop/assets/misc.styl @@ -13,7 +13,6 @@ @require '../components/artwork_item/stylesheets'; @require '../components/auction_artworks/stylesheets'; @require '../components/clock'; -@require '../apps/feature'; // jobs @require '../components/chevron_list'; @require '../apps/jobs/stylesheets'; diff --git a/src/desktop/assets/order.js b/src/desktop/assets/order.js deleted file mode 100644 index d1039da9780..00000000000 --- a/src/desktop/assets/order.js +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/order/client" diff --git a/src/desktop/assets/purchases.js b/src/desktop/assets/purchases.js deleted file mode 100644 index 0c90b83d77d..00000000000 --- a/src/desktop/assets/purchases.js +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/purchases/client" diff --git a/src/desktop/assets/search2.js b/src/desktop/assets/search2.js deleted file mode 100644 index ba540b106b3..00000000000 --- a/src/desktop/assets/search2.js +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/search2/client" diff --git a/src/desktop/assets/search2.styl b/src/desktop/assets/search2.styl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/desktop/assets/viewing-room.tsx b/src/desktop/assets/viewing-room.tsx deleted file mode 100644 index 29574b5a269..00000000000 --- a/src/desktop/assets/viewing-room.tsx +++ /dev/null @@ -1 +0,0 @@ -import "desktop/apps/viewing-room/client" diff --git a/src/desktop/apps/artist/components/__tests__/cta.jest.ts b/src/desktop/components/artistSignupModal/__tests__/artistSignupModal.tsx similarity index 97% rename from src/desktop/apps/artist/components/__tests__/cta.jest.ts rename to src/desktop/components/artistSignupModal/__tests__/artistSignupModal.tsx index 08498514dac..3ecbfa53204 100644 --- a/src/desktop/apps/artist/components/__tests__/cta.jest.ts +++ b/src/desktop/components/artistSignupModal/__tests__/artistSignupModal.tsx @@ -1,4 +1,4 @@ -import { setupArtistSignUpModal, setCookie, query } from "../cta" +import { query, setCookie, setupArtistSignUpModal } from "../artistSignupModal" import * as helpers from "desktop/lib/openAuthModal" jest.mock("desktop/components/cookies/index.coffee", () => ({ diff --git a/src/desktop/apps/artist/components/cta.ts b/src/desktop/components/artistSignupModal/artistSignupModal.tsx similarity index 96% rename from src/desktop/apps/artist/components/cta.ts rename to src/desktop/components/artistSignupModal/artistSignupModal.tsx index 0564b434c4c..ed6c373bdce 100644 --- a/src/desktop/apps/artist/components/cta.ts +++ b/src/desktop/components/artistSignupModal/artistSignupModal.tsx @@ -1,7 +1,8 @@ import { get } from "lodash" import { data as sd } from "sharify" import { handleScrollingAuthModal } from "desktop/lib/openAuthModal" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" + const Cookies = require("desktop/components/cookies/index.coffee") const mediator = require("desktop/lib/mediator.coffee") const metaphysics2 = require("lib/metaphysics2.coffee") diff --git a/src/desktop/apps/artwork/components/buyers_premium/index.coffee b/src/desktop/components/artworkBuyersPremium/index.coffee similarity index 64% rename from src/desktop/apps/artwork/components/buyers_premium/index.coffee rename to src/desktop/components/artworkBuyersPremium/index.coffee index b85187b2c9b..6f8731e854a 100644 --- a/src/desktop/apps/artwork/components/buyers_premium/index.coffee +++ b/src/desktop/components/artworkBuyersPremium/index.coffee @@ -1,6 +1,6 @@ -modalize = require '../../../../components/modalize/index.coffee' -Auction = require '../../../../models/auction.coffee' -fetchBuyersPremium = require '../../../../components/buyers_premium/index.coffee' +modalize = require '../modalize/index.coffee' +Auction = require '../../models/auction.coffee' +fetchBuyersPremium = require '../buyers_premium/index.coffee' module.exports = (auction_id) -> $el = $('
') @@ -19,4 +19,4 @@ module.exports = (auction_id) -> $el.html html open() - modal \ No newline at end of file + modal diff --git a/src/desktop/apps/artwork/components/buyers_premium/index.styl b/src/desktop/components/artworkBuyersPremium/index.styl similarity index 85% rename from src/desktop/apps/artwork/components/buyers_premium/index.styl rename to src/desktop/components/artworkBuyersPremium/index.styl index 74f56ee0d8b..6eeef36c983 100644 --- a/src/desktop/apps/artwork/components/buyers_premium/index.styl +++ b/src/desktop/components/artworkBuyersPremium/index.styl @@ -7,4 +7,4 @@ padding (gutter * 3) h1 - sans('l-headline') \ No newline at end of file + sans('l-headline') diff --git a/src/desktop/components/fair_week_marketing/PageScaffold.tsx b/src/desktop/components/fair_week_marketing/PageScaffold.tsx index a7ad850b71f..3532d37eadd 100644 --- a/src/desktop/components/fair_week_marketing/PageScaffold.tsx +++ b/src/desktop/components/fair_week_marketing/PageScaffold.tsx @@ -1,7 +1,7 @@ import React from "react" import styled, { ThemeProvider } from "styled-components" import colors from "v2/Assets/Colors" -import { Row, Col } from "@artsy/palette" +import { Col, Row } from "@artsy/palette" import Text from "v2/Components/Text" import Title from "v2/Components/Title" diff --git a/src/desktop/components/fair_week_marketing/__tests__/PageScaffold.jest.tsx b/src/desktop/components/fair_week_marketing/__tests__/PageScaffold.jest.tsx index e78eeb11e85..08ea0bb7187 100644 --- a/src/desktop/components/fair_week_marketing/__tests__/PageScaffold.jest.tsx +++ b/src/desktop/components/fair_week_marketing/__tests__/PageScaffold.jest.tsx @@ -1,5 +1,5 @@ import React from "react" -import { extend, cloneDeep } from "lodash" +import { cloneDeep, extend } from "lodash" import { mount } from "enzyme" import { FairWeekPageScaffold } from "../PageScaffold" diff --git a/src/desktop/components/main_layout/templates/experimental_app_shell.jade b/src/desktop/components/main_layout/templates/artsy_v2.jade similarity index 90% rename from src/desktop/components/main_layout/templates/experimental_app_shell.jade rename to src/desktop/components/main_layout/templates/artsy_v2.jade index 571d7941e28..aedb989e293 100644 --- a/src/desktop/components/main_layout/templates/experimental_app_shell.jade +++ b/src/desktop/components/main_layout/templates/artsy_v2.jade @@ -26,6 +26,6 @@ block body include ./json_ld block append scripts - script( src=asset("/assets/experimental-app-shell.js") ) + script( src=asset("/assets/artsy-v2.js") ) != scripts diff --git a/src/desktop/components/marketing_signup_modal/triggerMarketingModal.ts b/src/desktop/components/marketing_signup_modal/triggerMarketingModal.ts index ce9838aabe6..3d629a44a0a 100644 --- a/src/desktop/components/marketing_signup_modal/triggerMarketingModal.ts +++ b/src/desktop/components/marketing_signup_modal/triggerMarketingModal.ts @@ -5,8 +5,8 @@ import { handleScrollingAuthModal, openAuthModal, } from "desktop/lib/openAuthModal" -import { ModalType, ModalOptions } from "v2/Components/Authentication/Types" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ModalOptions, ModalType } from "v2/Components/Authentication/Types" +import { ContextModule, Intent } from "@artsy/cohesion" export const triggerMarketingModal = ( intent: Intent, diff --git a/src/desktop/components/react/stitch_components/NavBar.tsx b/src/desktop/components/react/stitch_components/NavBar.tsx index d10193fae66..6cbac9097b9 100644 --- a/src/desktop/components/react/stitch_components/NavBar.tsx +++ b/src/desktop/components/react/stitch_components/NavBar.tsx @@ -4,7 +4,7 @@ import { NavBar as ReactionNavBar } from "v2/Components/NavBar" import { FlashBanner } from "v2/Components/FlashBanner" import { data as sd } from "sharify" -import { SystemContextProvider, SystemContextProps } from "v2/Artsy" +import { SystemContextProps, SystemContextProvider } from "v2/Artsy" import { StagingBanner } from "./StagingBanner" const mediator = require("desktop/lib/mediator.coffee") diff --git a/src/desktop/components/split_test/running_tests.coffee b/src/desktop/components/split_test/running_tests.coffee index d73a473cc81..2e789a7b747 100644 --- a/src/desktop/components/split_test/running_tests.coffee +++ b/src/desktop/components/split_test/running_tests.coffee @@ -26,10 +26,4 @@ # this should export empty Object # module.exports = {} -module.exports = { - client_navigation_v5: - key: "client_navigation_v5" - outcomes: - control: 50 - experiment: 50 -} +module.exports = {} diff --git a/src/desktop/components/split_test/skipIfClientSideRoutingEnabled.ts b/src/desktop/components/split_test/skipIfClientSideRoutingEnabled.ts deleted file mode 100644 index 2aa953cf29c..00000000000 --- a/src/desktop/components/split_test/skipIfClientSideRoutingEnabled.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const skipIfClientSideRoutingEnabled = (_req, res, next) => { - // Remove once A/B test completes - if (res.locals.sd.CLIENT_NAVIGATION_V5 === "experiment") { - return next("route") - } - return next() -} diff --git a/src/desktop/config.coffee b/src/desktop/config.coffee index 7d570e28dd2..67e7235b68f 100644 --- a/src/desktop/config.coffee +++ b/src/desktop/config.coffee @@ -46,9 +46,6 @@ module.exports = EF_VENICE: '58f5eb75faef6a3a8e7fe1ad' EF_GUCCI: '5a009372c88a280f5e9efa7e' EF_VIDEO_GUIDE: '5901d64b4682400017f0e3cb' - - # FIXME: Remove experimental flag - EXPERIMENTAL_APP_SHELL: false, FACEBOOK_APP_NAMESPACE: "artsyinc" FACEBOOK_DOMAIN_VERIFICATION: 'yeg3dqrlq548zc77ggvfipouil1l1e' FACEBOOK_ID: null diff --git a/src/desktop/index.js b/src/desktop/index.ts similarity index 72% rename from src/desktop/index.js rename to src/desktop/index.ts index e0950a463bd..8afc01e12c3 100644 --- a/src/desktop/index.js +++ b/src/desktop/index.ts @@ -3,19 +3,36 @@ import * as globalReactModules from "desktop/components/react/stitch_components" const app = (module.exports = require("express")()) -// Configure stitch SSR functionality. Mounted here (rather than in setup) so -// changes to stitched code can be hot reloaded. -// See: https://github.com/artsy/stitch/tree/master/src/internal for more info. +/** + * ----------------------------------------------------------------------------- + * + * Developers! Wait! + * + * Before adding a new app to this file, can it live in `v2/Apps/getAppRoutes? + * In most cases, apps built after Jan 2020 can take advantage of our Relay-based + * SSR router (./apps/artsy-v2) which requires no additional server-side setup. + * + * ---------------------------------------------------------------------------- + */ + +/** + * Configure stitch SSR functionality. Mounted here (rather than in setup) so + * changes to stitched code can be hot reloaded. + * + * @see https://github.com/artsy/stitch/tree/master/src/internal for more info. + */ app.use( stitchMiddleware({ + // @ts-ignore modules: globalReactModules, wrapper: globalReactModules.StitchWrapper, }) ) -// NOTE: -// App order matters as some apps establish logic that is shared inside of subapps. -// Apps with hardcoded routes or "RESTful" routes +/** + * NOTE: App order matters as some apps establish logic that is shared inside + * of subapps. Apps with hardcoded routes or "RESTful" routes. + */ app.use(require("./apps/home")) app.use(require("./apps/editorial_features")) @@ -25,20 +42,12 @@ app.use(require("./apps/auctions")) app.use(require("./apps/auctions2").app) app.use(require("./apps/auction_lots")) -// TODO: Remove after AB test ends. -app.use(require("./apps/artist/server").app) -app.use(require("./apps/purchases/server").app) -app.use(require("./apps/conversations/server").app) -app.use(require("./apps/artwork/server").app) -app.use(require("./apps/collect/server").app) -app.use(require("./apps/search2/server").app) +// FIXME: Remove once JSONPage + new app shell is worked out app.use(require("./apps/art_keeps_going/server").app) -app.use(require("./apps/viewing-room/server").app) app.use(require("./apps/artists")) app.use(require("./apps/auction").app) app.use(require("./apps/auction_support")) -app.use(require("./apps/identity_verification/server").app) app.use(require("./apps/about")) app.use(require("./apps/categories").app) app.use(require("./apps/consign").app) @@ -52,7 +61,6 @@ app.use(require("./apps/gene")) app.use(require("./apps/geo")) app.use(require("./apps/jobs")) app.use(require("./apps/notifications")) -app.use(require("./apps/order/server").app) app.use(require("./apps/personalize")) app.use(require("./apps/press")) @@ -90,10 +98,6 @@ app.use(require("./apps/partner")) app.use(require("./apps/fair")) app.use(require("./apps/fair_info")) app.use(require("./apps/fair_organizer")) -app.use(require("./apps/feature")) - -// Must appear _after_ /feature so that we properly pass through in only some cases -app.use(require("./apps/feature-reaction/server").app) // User profiles app.use(require("./apps/user")) @@ -101,4 +105,6 @@ app.use(require("./apps/user")) // Used to test various SSR configurations app.use(require("./apps/ssr-experiments/server").app) -app.use(require("./apps/experimental-app-shell/server").app) +// Mount all `v2/Apps`. This ~must~ come last as it mounts our v2 apps in a +// wild-card fashion. +app.use(require("./apps/artsy-v2/server").app) diff --git a/src/desktop/lib/__tests__/openAuthModal.jest.ts b/src/desktop/lib/__tests__/openAuthModal.jest.ts index 90ca1b6c662..fedd0a63c6d 100644 --- a/src/desktop/lib/__tests__/openAuthModal.jest.ts +++ b/src/desktop/lib/__tests__/openAuthModal.jest.ts @@ -1,6 +1,6 @@ -import { openAuthModal, handleScrollingAuthModal } from "../openAuthModal" +import { handleScrollingAuthModal, openAuthModal } from "../openAuthModal" import { ModalType } from "v2/Components/Authentication/Types" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" jest.mock("desktop/lib/mediator.coffee", () => ({ trigger: jest.fn(), diff --git a/src/desktop/lib/global_client_setup.tsx b/src/desktop/lib/global_client_setup.tsx index 699bf36d248..64fabb4fc6b 100644 --- a/src/desktop/lib/global_client_setup.tsx +++ b/src/desktop/lib/global_client_setup.tsx @@ -126,7 +126,7 @@ function setupJquery() { // once you click it. For these cases do `$el.click -> $(@).hidehover()` and // the menu will hide and then remove the `display` property so the default // CSS will kick in again. - $.fn.hidehover = function () { + $.fn.hidehover = function() { const $el = $(this) $el.css({ display: "none" }) return setTimeout(() => $el.css({ display: "" }), 200) @@ -146,17 +146,10 @@ function setupErrorReporting() { if (sd.NODE_ENV === "production") { Sentry.init({ dsn: sd.SENTRY_PUBLIC_DSN }) - // FIXME: Remove once A/B test ends - Sentry.addBreadcrumb({ - category: "experimental-app-shell-ab-test", - message: `A/B v5 test group: ${sd.CLIENT_NAVIGATION_V5}`, - level: Sentry.Severity.Info, - }) - const user = sd && sd.CURRENT_USER if (sd.CURRENT_USER) { - Sentry.configureScope((scope) => { + Sentry.configureScope(scope => { scope.setUser(_.pick(user, "id", "email")) }) } @@ -182,7 +175,7 @@ export function trackAuthenticationEvents() { const modes = ["login", "signup"] const user = sd && sd.CURRENT_USER - modes.forEach((mode) => { + modes.forEach(mode => { if (Cookies.get(`analytics-${mode}`)) { const data = JSON.parse(Cookies.get(`analytics-${mode}`)) Cookies.expire(`analytics-${mode}`) diff --git a/src/desktop/lib/openAuthModal.ts b/src/desktop/lib/openAuthModal.ts index c81ea6719f4..f755392e88c 100644 --- a/src/desktop/lib/openAuthModal.ts +++ b/src/desktop/lib/openAuthModal.ts @@ -1,4 +1,4 @@ -import { ModalType, ModalOptions } from "v2/Components/Authentication/Types" +import { ModalOptions, ModalType } from "v2/Components/Authentication/Types" import { data as sd } from "sharify" const mediator = require("desktop/lib/mediator.coffee") diff --git a/src/lib/__tests__/volley.jest.ts b/src/lib/__tests__/volley.jest.ts index 999a47a66c7..3e3a571d0cf 100644 --- a/src/lib/__tests__/volley.jest.ts +++ b/src/lib/__tests__/volley.jest.ts @@ -12,7 +12,7 @@ jest.mock("sharify", () => ({ }, })) -import { reportLoadTimeToVolley, metricPayload } from "../volley" +import { metricPayload, reportLoadTimeToVolley } from "../volley" describe("metricsPayload", () => { it("should return null if the duration is null", () => { diff --git a/src/lib/middleware/__tests__/unsupportedBrowser.jest.ts b/src/lib/middleware/__tests__/unsupportedBrowser.jest.ts index db31d0a404c..324672068d3 100644 --- a/src/lib/middleware/__tests__/unsupportedBrowser.jest.ts +++ b/src/lib/middleware/__tests__/unsupportedBrowser.jest.ts @@ -1,6 +1,6 @@ import { - isUnsupported, getRedirectTo, + isUnsupported, unsupportedBrowserCheck, } from "../unsupportedBrowser" import useragent from "useragent" diff --git a/src/lib/middleware/pageCacheMiddleware.ts b/src/lib/middleware/pageCacheMiddleware.ts index 17bf952ed7d..b097327714f 100644 --- a/src/lib/middleware/pageCacheMiddleware.ts +++ b/src/lib/middleware/pageCacheMiddleware.ts @@ -2,17 +2,17 @@ import { // @ts-ignore PAGE_CACHE_ENABLED, // @ts-ignore - PAGE_CACHE_TYPES, + PAGE_CACHE_EXPIRY_SECONDS, // @ts-ignore PAGE_CACHE_NAMESPACE, // @ts-ignore - PAGE_CACHE_VERSION, + PAGE_CACHE_RETRIEVAL_TIMEOUT_MS, // @ts-ignore - PAGE_CACHE_EXPIRY_SECONDS, + PAGE_CACHE_TYPES, // @ts-ignore - PAGE_CACHE_RETRIEVAL_TIMEOUT_MS, + PAGE_CACHE_VERSION, } from "../../config" -import { Request, Response, NextFunction } from "express" +import { NextFunction, Request, Response } from "express" const cache = require("lib/cache.coffee") const runningTests = Object.keys( require("desktop/components/split_test/running_tests.coffee") diff --git a/src/lib/setup_sharify.js b/src/lib/setup_sharify.js index 7c568658776..edaab8cd84d 100644 --- a/src/lib/setup_sharify.js +++ b/src/lib/setup_sharify.js @@ -52,9 +52,6 @@ sharify.data = _.extend( "EF_GUCCI", "EF_VENICE", "EF_VIDEO_GUIDE", - - // FIXME: Remove experimental flag - "EXPERIMENTAL_APP_SHELL", "FACEBOOK_APP_NAMESPACE", "FACEBOOK_ID", "FORCE_CLOUDFRONT_URL", diff --git a/src/lib/volley.ts b/src/lib/volley.ts index c9f1dfd086a..595f80b93f6 100644 --- a/src/lib/volley.ts +++ b/src/lib/volley.ts @@ -2,11 +2,11 @@ import { data as sd } from "sharify" import request from "superagent" import { getDomComplete, - getLoadEventEnd, - getFirstPaint, - getFirstContentfulPaint, getDomContentLoadedEnd, getDomContentLoadedStart, + getFirstContentfulPaint, + getFirstPaint, + getLoadEventEnd, getTTI, } from "./userPerformanceMetrics" @@ -45,16 +45,18 @@ export async function reportLoadTimeToVolley( metricsMap: MetricMap = defaultMetrics ) { if (sd.VOLLEY_ENDPOINT) { - const metrics = (await Promise.all( - Object.keys(metricsMap).map(async metricName => - metricPayload( - pageType, - deviceType, - metricName, - await metricsMap[metricName]() + const metrics = ( + await Promise.all( + Object.keys(metricsMap).map(async metricName => + metricPayload( + pageType, + deviceType, + metricName, + await metricsMap[metricName]() + ) ) ) - )).filter(metric => metric != null) + ).filter(metric => metric != null) if (metrics.length > 0) { return request.post(sd.VOLLEY_ENDPOINT).send({ serviceName: "force", diff --git a/src/mobile/apps/feature/client/filter.coffee b/src/mobile/apps/feature/client/filter.coffee deleted file mode 100644 index e64d281c92c..00000000000 --- a/src/mobile/apps/feature/client/filter.coffee +++ /dev/null @@ -1,49 +0,0 @@ -Backbone = require 'backbone' - -module.exports = class FilterView extends Backbone.View - - events: - 'click nav a': 'triggerArtworkFilter' - 'click .filter-dropdown': 'onFilterTriggerClick' - - sortHash: - 'artist-a-to-z': (a) -> - a.related().artist.get('sortable_id') - 'most-bids': (a) -> - - a.related().saleArtwork.get('bidder_positions_count') - 'least-bids': (a) -> - a.related().saleArtwork.get('bidder_positions_count') - 'highest-current-bid': (a) -> - - a.related().saleArtwork.get('highest_bid_amount_cents') - 'lowest-current-bid': (a) -> - a.related().saleArtwork.get('highest_bid_amount_cents') - - initialize: (options) -> - @artworks = options.artworks - @on 'doneFetching', => - @sortArtworks options.startingSort - - triggerArtworkFilter: (event) -> - $link = $(event.target) - return false if $link.is '.is-active' - @$('nav a.is-active').removeClass 'is-active' - $link.addClass 'is-active' - @sortArtworks $(event.target).data 'val' - false - - sortArtworks: (sortId) -> - return unless @sortHash[sortId] - @artworks.comparator = @sortHash[sortId] - @artworks.sort() - @artworks.trigger 'filterSort' - - onFilterTriggerClick: (event) -> - $dropdown = @$('.filter-dropdown') - - # Is there another active dropdown? - for activeDropdown in @$('.filter-dropdown.is-active') - $activeDropdown = $(activeDropdown) - if $activeDropdown.data('group') isnt $dropdown.data('group') - $activeDropdown.removeClass 'is-active' - $dropdown.toggleClass 'is-active' - false diff --git a/src/mobile/apps/feature/client/index.coffee b/src/mobile/apps/feature/client/index.coffee deleted file mode 100644 index fe87a40ce2f..00000000000 --- a/src/mobile/apps/feature/client/index.coffee +++ /dev/null @@ -1,85 +0,0 @@ -sd = require('sharify').data -Backbone = require 'backbone' -FilterView = require './filter.coffee' -bootstrap = require '../../../components/layout/bootstrap.coffee' -AuctionClockView = require '../../../components/auction_clock/view.coffee' -Feature = require '../../../models/feature.coffee' -CurrentUser = require '../../../models/current_user.coffee' -Profile = require '../../../models/profile.coffee' -itemsTemplate = -> require('../templates/items.jade') arguments... -artworkListTemplate = -> require('../../../components/artwork_list/template.jade') arguments... -featuredItemsTemplate = -> require('../../../components/featured_items/template.jade') arguments... -auctionArtworksTemplate = -> require('../../../components/auction_artwork_list/template.jade') arguments... -videoTemplate = -> require('../../../components/video/template.jade') arguments... -auctionDetailTemplate = -> require('../templates/auction_detail.jade') arguments... - -module.exports.FeatureView = class FeatureView extends Backbone.View - - initialize: (options) -> - { @user } = options - - @model.on 'change:sale', => - @sale = @model.get 'sale' - - @model.fetchSets - setsSuccess: (sets) => - @sets = sets - @render() - artworksSuccess: @doneFetchingSaleArtworks - - isAuction: => - @sale?.isAuction() - - render: => - if @isAuction() then @renderAuction() else @renderItems() - - doneFetchingSaleArtworks: => - artworks = [] - for set in @sets when set.get('type') is 'artworks' - if @isAuction() and @sale?.isAuctionPromo() - set.set title: 'Featured works' - else if @isAuction() - set.set title: 'Works for bidding on Artsy' - artworks = set.get('data') - artworks.on 'filterSort', => - @renderArtworkFiltering artworks - @renderArtworkFiltering artworks - - renderArtworkFiltering: (artworks) -> - @renderItems() - @setupArtworkFiltering artworks - - renderAuction: -> - @$('.js-feature-auction-section').html auctionDetailTemplate(sale: @sale) - - @auctionClockView = new AuctionClockView el: @$('#feature-page-auction-clock'), model: @sale - @auctionClockView.start() - - @user.registeredForAuction @sale.get('id'), success: (registered) => - if not registered and (@sale.get('auction_state') is 'preview') - @auctionClockView.$el.addClass('feature-auction-section-unregistered') - @$('#feature-page-auction-register-link').prop('href', @sale.registerUrl(location?.href)) - - setupArtworkFiltering: (artworks) -> - @filterView = new FilterView - el: @$('.feature-artwork-filter') - artworks: artworks - - @artworkFilteringSetup = true - - renderItems: => - @$('#feature-page-items').html itemsTemplate - items: @sets - artworkListTemplate: artworkListTemplate - featuredItemsTemplate: featuredItemsTemplate - auctionArtworksTemplate: auctionArtworksTemplate - videoTemplate: videoTemplate - isAuction: @isAuction() - sale: @sale - -module.exports.init = -> - bootstrap() - new FeatureView - el: $('body') - model: new Feature sd.FEATURE - user: new CurrentUser diff --git a/src/mobile/apps/feature/components/clock/index.coffee b/src/mobile/apps/feature/components/clock/index.coffee deleted file mode 100644 index 644dbf0da9a..00000000000 --- a/src/mobile/apps/feature/components/clock/index.coffee +++ /dev/null @@ -1,35 +0,0 @@ -moment = require 'moment' -{ compact } = require 'underscore' - -UNITS = [ - { send: 'months', label: 'mos' } - { send: 'days', label: 'day' } - { send: 'hours', label: 'hr' } - { send: 'minutes', label: 'min' } - { send: 'seconds', label: 'sec' } -] - -pad = (n, p = 2) -> - ('00' + n).slice -(p) - -compute = (duration) -> - UNITS.map (unit) -> - unit.value = pad duration[unit.send]() - unit - -compacted = (computed) -> - compact computed.map (unit) -> - if unit.send is 'months' - unit if unit.value isnt '00' - else - unit - -render = (parsed) -> - diff = parsed.diff moment() - return false if diff < 0 - duration = moment.duration diff - compacted compute duration - -module.exports = (timestamp) -> - parsed = moment.utc timestamp - render parsed diff --git a/src/mobile/apps/feature/components/clock/index.jade b/src/mobile/apps/feature/components/clock/index.jade deleted file mode 100644 index ab3815111c0..00000000000 --- a/src/mobile/apps/feature/components/clock/index.jade +++ /dev/null @@ -1,12 +0,0 @@ -if countdown - .countdown-clock - if label - .countdown-clock__label - = label - .countdown-clock__clock - for unit in countdown - .countdown-clock__clock__unit - span.countdown-clock__clock__unit__value - = unit.value - span.countdown-clock__clock__unit__label - = unit.label diff --git a/src/mobile/apps/feature/components/clock/index.styl b/src/mobile/apps/feature/components/clock/index.styl deleted file mode 100644 index 33db27a2421..00000000000 --- a/src/mobile/apps/feature/components/clock/index.styl +++ /dev/null @@ -1,40 +0,0 @@ -.countdown-clock - &__label - sans('s-headline', true) - - &__clock - white-space nowrap - - &__unit - display inline-block - position relative - width 2em - margin-right 0.5em - vertical-align bottom - &:last-child - margin-right 0 - - &:after - content ':' - position absolute - top 0 - right 0 - sans('l-headline', true) - - &:last-child - margin-right 0 - &:after - display none - - &__value - &__label - display block - - &__value - sans('l-headline', true) - - &__label - avant-garde() - font-size 9px - line-height 1 - color gray-color diff --git a/src/mobile/apps/feature/components/clock/test/index.test.coffee b/src/mobile/apps/feature/components/clock/test/index.test.coffee deleted file mode 100644 index e4c38c1e0d3..00000000000 --- a/src/mobile/apps/feature/components/clock/test/index.test.coffee +++ /dev/null @@ -1,37 +0,0 @@ -sinon = require 'sinon' -moment = require 'moment' -countdown = require '../index' - -describe 'countdown', -> - beforeEach -> - @clock = sinon.useFakeTimers() - - afterEach -> - @clock.restore() - - it 'computes the countdown units given a timestamp', -> - timestamp = moment().add(1, 'day').format() - - countdown timestamp - .should.eql [ - { send: 'days', label: 'day', value: '01' } - { send: 'hours', label: 'hr', value: '00' } - { send: 'minutes', label: 'min', value: '00' } - { send: 'seconds', label: 'sec', value: '00' } - ] - - @clock.tick 1000 - - countdown timestamp - .should.eql [ - { send: 'days', label: 'day', value: '00' } - { send: 'hours', label: 'hr', value: '23' } - { send: 'minutes', label: 'min', value: '59' } - { send: 'seconds', label: 'sec', value: '59' } - ] - - it 'returns false if the timestamp has passed', -> - timestamp = moment().subtract(1, 'day').format() - - countdown timestamp - .should.be.false() diff --git a/src/mobile/apps/feature/components/clock/test/view.test.coffee b/src/mobile/apps/feature/components/clock/test/view.test.coffee deleted file mode 100644 index 31815051620..00000000000 --- a/src/mobile/apps/feature/components/clock/test/view.test.coffee +++ /dev/null @@ -1,60 +0,0 @@ -benv = require 'benv' -sinon = require 'sinon' -moment = require 'moment' -Backbone = require 'backbone' - -describe 'ClockView', -> - before (done) -> - benv.setup -> - benv.expose $: benv.require('jquery'), jQuery: benv.require('jquery') - Backbone.$ = $ - done() - - after -> - benv.teardown() - - beforeEach -> - @clock = sinon.useFakeTimers() - # FIXME: conflicts with jsdom - # sinon.spy(window.location, 'reload') - - # Dynamically import ClockView constructor so that it pulls in the stubbed - # setTimeout from sinon.useFakeTimers. - @ClockView = benv.requireWithJadeify require.resolve('../view'), ['template'] - - afterEach -> - @clock.restore() - # FIXME: conflicts with jsdom - # location.reload.restore() - - xit 'does trigger a reload for a timestamp 1 day away, only after the day passes', -> - # FIXME: jsdom window errors on window.location.reload - timestamp = moment().add(1, 'day').format() - view = new @ClockView timestamp: timestamp - @clock.tick(23 * 60 * 60 * 1000) - window.location.reload.called.should.be.false() - @clock.tick(60 * 60 * 1000) - window.location.reload.called.should.be.true() - - xit 'does not trigger an immediate reload for a timestamp 26 days away (past the 24.8 day limit for setTimeout)', -> - timestamp = moment().add(26, 'day').format() - view = new @ClockView timestamp: timestamp - @clock.tick(1000) - window.location.reload.called.should.be.false() - - it 'renders the clock when there is a timestamp in the future', -> - timestamp = moment().add(1, 'day').format() - view = new @ClockView timestamp: timestamp - view.render().$el.text() - .should.equal '01day00hr00min00sec' - - it 'optionally accepts a label', -> - timestamp = moment().add(1, 'day').format() - view = new @ClockView label: 'Auction closes in', timestamp: timestamp - view.render().$el.text() - .should.equal 'Auction closes in01day00hr00min00sec' - - it 'renders empty if the timestamp has passed', -> - timestamp = moment().subtract(1, 'day').format() - view = new @ClockView timestamp: timestamp - view.render().$el.html().should.equal '' diff --git a/src/mobile/apps/feature/components/clock/view.coffee b/src/mobile/apps/feature/components/clock/view.coffee deleted file mode 100644 index 0bebc9f2f92..00000000000 --- a/src/mobile/apps/feature/components/clock/view.coffee +++ /dev/null @@ -1,29 +0,0 @@ -moment = require 'moment' -Backbone = require 'backbone' -countdown = require './index.coffee' -template = -> require('./index.jade') arguments... - -module.exports = class ClockView extends Backbone.View - initialize: ({ @label, @timestamp }) -> - endAt = moment.utc(@timestamp) - - if endAt.isAfter() - # setTimeout fires immediately for any value 2^31 or greater, so prevent - # that from happening. - reloadMs = Math.min(endAt.diff(moment.utc()), 0x7FFFFFFF) - setTimeout -> - location.reload() - , reloadMs - - start: -> - @timer = setInterval @render.bind(this), 1000 - - render: -> - @$el.html template - label: @label - countdown: countdown(@timestamp) - this - - remove: -> - clearInteval @timer - super diff --git a/src/mobile/apps/feature/helpers.coffee b/src/mobile/apps/feature/helpers.coffee deleted file mode 100644 index f594e882fa3..00000000000 --- a/src/mobile/apps/feature/helpers.coffee +++ /dev/null @@ -1,26 +0,0 @@ -moment = require 'moment' -clock = require './components/clock/index.coffee' - -module.exports = - showCountdown: (startAt, liveStartAt) -> - return false if liveStartAt and moment(liveStartAt).isBefore() - true - - countdownLabel: (startAt, liveStartAt) -> - if liveStartAt and moment(startAt).isBefore() - 'Live bidding opening in' - else if moment(startAt).isBefore() - 'Auction closes in' - else - 'Auction opens in' - - countdownTimestamp: countdownTimestamp = (startAt, endAt, liveStartAt) -> - if liveStartAt and moment(startAt).isBefore() - liveStartAt - else if moment(startAt).isBefore() - endAt - else - startAt - - countdownClock: (startAt, endAt) -> - clock countdownTimestamp arguments... diff --git a/src/mobile/apps/feature/index.coffee b/src/mobile/apps/feature/index.coffee deleted file mode 100644 index a3fcc6243e5..00000000000 --- a/src/mobile/apps/feature/index.coffee +++ /dev/null @@ -1,15 +0,0 @@ -# -# The feature page (e.g. Whitney Sale or Venice Bienale) -# - -express = require 'express' -routes = require './routes' -accounting = require 'accounting' - -app = module.exports = express() -app.locals.accounting = accounting - -app.set 'views', __dirname + '/templates' -app.set 'view engine', 'jade' -app.get '/feature/:id', routes.index -app.get '/feature/:id/:queryParams', routes.index \ No newline at end of file diff --git a/src/mobile/apps/feature/routes.coffee b/src/mobile/apps/feature/routes.coffee deleted file mode 100644 index 37997a5addf..00000000000 --- a/src/mobile/apps/feature/routes.coffee +++ /dev/null @@ -1,12 +0,0 @@ -Feature = require '../../models/feature' - -module.exports.index = (req, res, next) -> - new Feature(id: req.params.id).fetch - cache: true - success: (feature) -> - if feature.has('version') && feature.get('version') > 1 - next() - else - res.locals.sd.FEATURE = feature.toJSON() - res.render 'page', feature: feature - error: res.backboneError \ No newline at end of file diff --git a/src/mobile/apps/feature/stylesheets/index.styl b/src/mobile/apps/feature/stylesheets/index.styl deleted file mode 100644 index d4e0301281d..00000000000 --- a/src/mobile/apps/feature/stylesheets/index.styl +++ /dev/null @@ -1,132 +0,0 @@ -@import '../../../components/stylus_lib' - -#feature-page-image - height 150px - background-position center center - background-size cover - -#feature-page-name - font-size 32px - padding-bottom 15px - text-align center - line-height 1.2em - margin 20px 0 - -#feature-page-description - padding 20px 0 - border-top 1px solid light-gray-border-color - text-align center - -.feature-page-items-description - padding 20px 0 - border-bottom 1px solid light-gray-border-color - text-align center - -.feature-page-header - margin 40px 0 10px 0 - -.feature-page-items-container - &:first-child - .feature-page-header - margin-top: 10px - &:last-child - .featured-items li - border-bottom: 0px solid - -.feature-auction-section - text-align center - a - color dark-gray-text-color - margin-top 10px - display inline-block - .avant-garde-box-button-black - color white - -.auction-artwork-list - margin-top 55px - -#feature-page-auction-clock - background white - position relative - top -1px - padding-bottom 15px - clearfix() - &.feature-auction-section-unregistered - .auction-clock - width 55% - display inline-block - .avant-garde-box-button - display inline-block - vertical-align top - width 45% - border-left white 5px solid - border-top 1px - border-bottom 1px - margin: 2px 0 - font-size: 11px - .avant-garde-box-button - display none - .auction-clock - vertical-align top - width 100% - display block - float left - padding-right 5px - small - font-size 8px - margin -5px 0 - h2 - font-size 10px - margin -3px 0 - letter-spacing: 1px - .auction-clock-value - font-size 17px - margin 0 - -#feature-page-items - padding 20px 0 - border-top 1px solid light-gray-border-color - video - width 100% - margin 20px 0 - .featured-items-details - h1 - font-size 22px - line-height 1.2em - margin-bottom 9px - h3 - color dark-gray-text-color - serif() - text-transform none - letter-spacing 0px - line-height 142% - font-size 14px - .featured-items - li:first-child - padding-top 0px - border-top 0px - li.half - &:first-child - margin-bottom 0px - .featured-items-details, img - width 100% - padding-left 0px - padding-right 0px - img - margin-bottom 16px - -#feature-auction-logo - background top center no-repeat - width 100% - height 40px //- Hack for LAMA to work around profile icons only being square - margin-top 20px - -#feature-banner - width 100% - height 140px - background center center - background-size cover - -.feature-artwork-filter - position absolute - right 0 diff --git a/src/mobile/apps/feature/templates/auction_detail.jade b/src/mobile/apps/feature/templates/auction_detail.jade deleted file mode 100644 index 70426d3d77d..00000000000 --- a/src/mobile/apps/feature/templates/auction_detail.jade +++ /dev/null @@ -1,8 +0,0 @@ -#feature-page-auction-clock - include ../../../components/auction_clock/template - - unless sale.isAuctionPromo() - a#feature-page-auction-register-link.avant-garde-box-button.avant-garde-box-button-black - | Register to Bid - a#feature-page-auction-bidding-information-link( href='/auction-info' ) - | How bidding works diff --git a/src/mobile/apps/feature/templates/filter.jade b/src/mobile/apps/feature/templates/filter.jade deleted file mode 100644 index f28fafddc20..00000000000 --- a/src/mobile/apps/feature/templates/filter.jade +++ /dev/null @@ -1,10 +0,0 @@ -include ../../../components/filter/dropdown_mixin.jade - -.feature-artwork-filter - +filter-dropdown('Sort By','sort', { - 'Artist A-Z': 'artist-a-to-z', - 'Most Bids': 'most-bids', - 'Least Bids': 'least-bids', - 'Highest Current Bid': 'highest-current-bid', - 'Lowest Current Bid': 'lowest-current-bid' - }, true) diff --git a/src/mobile/apps/feature/templates/items.jade b/src/mobile/apps/feature/templates/items.jade deleted file mode 100644 index 665f52803a1..00000000000 --- a/src/mobile/apps/feature/templates/items.jade +++ /dev/null @@ -1,21 +0,0 @@ -for item, i in items - .feature-page-items-container - if item.get('name') || item.get('title') - h2.avant-garde-header-center.feature-page-header - = item.mdToHtmlToText('name') || item.mdToHtmlToText('title') - - if item.get('description') - .feature-page-items-description - != item.mdToHtml('description') - - case item.get('type') - when 'artworks' - if isAuction - include ./filter.jade - != auctionArtworksTemplate({ artworks: item.get('data').models, auction: sale }) - else - != artworkListTemplate({ artworks: item.get('data').models }) - when 'featured links' - != featuredItemsTemplate({ items: item.get('data').models }) - when 'video' - != videoTemplate({ items: item.get('data').models }) diff --git a/src/mobile/apps/feature/templates/page.jade b/src/mobile/apps/feature/templates/page.jade deleted file mode 100644 index 1228c81358f..00000000000 --- a/src/mobile/apps/feature/templates/page.jade +++ /dev/null @@ -1,24 +0,0 @@ -extends ../../../components/layout/templates/main - -block content - if feature.hasImage() && feature.imageUrl() - #feature-page-image( style="background-image: url(#{feature.imageUrl()})" ) - - if feature.imageUrl('wide') - #feature-banner( - style= "background-image: url(#{feature.imageUrl('wide')})" - ) - - .main-side-margin - h1#feature-page-name - = feature.get('name') - - if feature.get('description') - #feature-page-description - != feature.mdToHtml('description') - - .feature-auction-section.js-feature-auction-section - //- Rendered separately - - #feature-page-items - .loading-spinner diff --git a/src/mobile/apps/feature/test/client/index.test.coffee b/src/mobile/apps/feature/test/client/index.test.coffee deleted file mode 100644 index d08a8d76762..00000000000 --- a/src/mobile/apps/feature/test/client/index.test.coffee +++ /dev/null @@ -1,177 +0,0 @@ -Backbone = require 'backbone' -sinon = require 'sinon' -_ = require 'underscore' -{ fabricate } = require '@artsy/antigravity' -Feature = require '../../../../models/feature' -Sale = require '../../../../models/sale' -Artworks = require '../../../../collections/artworks' -Videos = require '../../../../collections/videos' -FeaturedLinks = require '../../../../collections/featured_links' -SaleArtwork = require '../../../../models/sale_artwork' -CurrentUser = require '../../../../models/current_user.coffee' -benv = require 'benv' -{ resolve } = require 'path' - -xdescribe 'Feature page client-side code', -> - # FIXME: errors setting up due to react-flickity jquery errors - # Uncaught TypeError: Cannot set property 'imagesLoaded' of undefined - beforeEach (done) -> - benv.setup => - benv.expose { - $: benv.require 'jquery' - jQuery: require 'jquery' - matchMedia: () -> - media: "" - matches: false - addListener: () -> null - removeListener: () -> null - } - Backbone.$ = $ - sinon.stub Backbone, 'sync' - benv.render resolve(__dirname, '../../templates/page.jade'), { - feature: new Feature fabricate 'feature' - sd: { API_URL: 'foo/bar' } - }, => - { @FeatureView, @init } = benv.requireWithJadeify resolve(__dirname, '../../client'), [ - 'artworkListTemplate' - 'featuredItemsTemplate' - 'itemsTemplate' - 'auctionArtworksTemplate' - 'videoTemplate' - 'auctionDetailTemplate' - ] - @view = new @FeatureView - el: $ 'body' - model: new Feature fabricate 'feature', - sale: new Sale(fabricate 'sale', is_auction: true) - start_at: new Date(2000,1,1).getTime() - end_at: new Date(3000,1,1).getTime() - user: new CurrentUser fabricate 'user' - @view.sale = @view.model.get('sale') - @view.sets = new FeaturedLinks([ - { - type: 'featured link' - title: 'Featured Link 1' - } - { - type: 'featured link' - title: 'Featured Link 2' - } - { - type: 'artworks' - title: 'Some Artworks!' - data: new Artworks [fabricate 'artwork', - sale_artwork: fabricate 'sale_artwork', display_low_estimate_dollars: '$3,000', display_high_estimate_dollars: '$7,000' - ] - } - { - type: 'video' - title: 'Cat videos!' - data: new Videos [ fabricate 'video' ] - } - ]).models - @view.render() - @view.doneFetchingSaleArtworks() - done() - - afterEach -> - benv.teardown() - Backbone.sync.restore() - - describe '#init', -> - - it 'renders the featured content', -> - @init() - _.last(Backbone.sync.args)[2].success([fabricate 'set', display_on_martsy: true]) - _.last(Backbone.sync.args)[2].success([ - fabricate 'featured_link', title: 'Featured link for this awesome page', display_on_martsy: true - ]) - _.last(Backbone.sync.args)[2].success([]) - $('#feature-page-items').html().should.containEql 'Featured link for this awesome page' - - describe 'FeatureView', -> - - describe 'open', -> - - beforeEach -> - @view.sale.set - auction_state: 'open' - - it 'does not render the register button if you are not registered', -> - @view.user.registeredForAuction = (id, options = {}) -> options.success false - @view.renderAuction() - @view.$('#feature-page-auction-clock').prop('class').should.not.containEql('feature-auction-section-unregistered') - @view.$('#feature-page-auction-register-link').prop('href').should.not.containEql 'auction-registration/whtney-art-party' - - it 'does not render the register button if you are logged out', -> - @view.renderAuction() - _.last(Backbone.sync.args)[2].error { responseText: "A user is required" } - @view.$('#feature-page-auction-clock').prop('class').should.not.containEql('feature-auction-section-unregistered') - @view.$('#feature-page-auction-register-link').prop('href').should.not.containEql 'auction-registration/whtney-art-party' - - describe '#renderAuction', -> - - beforeEach -> - @view.renderAuction() - - it 'truncates to the first item and the artworks in the sale', -> - @view.$el.html().should.not.containEql 'Featured link 2' - - it 'renames the artworks title', -> - @view.$el.html().should.not.containEql 'Some Artworks!' - @view.$el.html().should.containEql 'Works for bidding' - - it 'displays the artwork estimate', -> - @view.$('.aali-estimate').text().should.containEql 'Estimate: $3,000–$7,000' - - it 'displays the bid related links', -> - @view.$('#feature-page-auction-register-link').should.have.lengthOf 1 - @view.$('#feature-page-auction-bidding-information-link').should.have.lengthOf 1 - - describe 'preview', -> - beforeEach -> - @view.sale.set - auction_state: 'preview' - - it 'does not inject the auction register button if you are registered', -> - @view.user.registeredForAuction = (id, options = {}) -> options.success true - @view.renderAuction() - - @view.$('#feature-page-auction-clock').prop('class').should.not.containEql('feature-auction-section-unregistered') - @view.$('#feature-page-auction-register-link').prop('href').should.not.containEql 'auction-registration/whtney-art-party' - - it 'injects the auction register link if you are not registered', -> - @view.user.registeredForAuction = (id, options = {}) -> options.success false - @view.renderAuction() - @view.$('#feature-page-auction-clock').prop('class').should.containEql('feature-auction-section-unregistered') - @view.$('#feature-page-auction-register-link').prop('href') - .should.containEql 'auction-registration/whtney-art-party' - - it 'renders the link to register if the user is logged out', -> - @view.renderAuction() - _.last(Backbone.sync.args)[2].error { responseText: "A user is required" } - @view.$('#feature-page-auction-register-link').prop('href') - .should.containEql 'auction-registration/whtney-art-party' - - describe 'isAuctionPromo', -> - beforeEach -> - @view.sale.set 'sale_type', 'auction promo' - @view.renderAuction() - - it 'does not display the bid related links', -> - @view.$('#feature-page-auction-register-link').should.have.lengthOf 0 - @view.$('#feature-page-auction-bidding-information-link').should.have.lengthOf 0 - - describe '#renderItems', -> - - it 'renders artworks as auction items', -> - @view.sets[2].get('data').first().set title: 'Foo to the bar' - @view.renderItems() - @view.$('.auction-artwork-list').html().should.containEql 'Foo to the bar' - - it 'render Video item types in html5 video and includes a poster image', -> - @view.renderItems() - @view.$el.find('video').length.should.be.ok() - @view.$el.find('video').attr('poster').length.should.be.ok() - - it 'renders featured links in converted markdown' diff --git a/src/mobile/apps/feature/test/routes.test.coffee b/src/mobile/apps/feature/test/routes.test.coffee deleted file mode 100644 index 9f99a346f37..00000000000 --- a/src/mobile/apps/feature/test/routes.test.coffee +++ /dev/null @@ -1,25 +0,0 @@ -{ fabricate } = require '@artsy/antigravity' -sinon = require 'sinon' -rewire = require 'rewire' -routes = rewire '../routes' -Backbone = require 'backbone' - -describe '#index', -> - - beforeEach -> - sinon.stub Backbone, 'sync' - - afterEach -> - Backbone.sync.restore() - - it 'renders the feature page', -> - routes.index { params: { id: 'awesome-feature' } }, { locals: { sd: {} }, render: renderStub = sinon.stub() } - Backbone.sync.args[0][2].success fabricate 'feature', name: 'Awesome Feature' - renderStub.args[0][0].should.equal 'page' - renderStub.args[0][1].feature.get('name').should.equal 'Awesome Feature' - - it 'passes through the route if the version is too high', -> - next = sinon.stub() - routes.index { params: { id: 'awesome-feature' } }, { locals: { sd: {} }, render: renderStub = sinon.stub() }, next - Backbone.sync.args[0][2].success fabricate 'feature', name: 'Awesome Feature', version: 2 - next.calledOnce.should.be.ok() diff --git a/src/mobile/assets/mobile_all.coffee b/src/mobile/assets/mobile_all.coffee index e1db53297af..c81b287aca5 100644 --- a/src/mobile/assets/mobile_all.coffee +++ b/src/mobile/assets/mobile_all.coffee @@ -30,9 +30,6 @@ hash = '^/unsubscribe*': -> require('../apps/unsubscribe/client.coffee').init() - '^/feature/([^/]+)$': -> - require('../apps/feature/client/index.coffee').init() - '^/profile/.*': -> require '../apps/profile/client.coffee' diff --git a/src/mobile/assets/mobile_all.styl b/src/mobile/assets/mobile_all.styl index 506cd127b91..b2bd8ada9be 100644 --- a/src/mobile/assets/mobile_all.styl +++ b/src/mobile/assets/mobile_all.styl @@ -13,7 +13,6 @@ @import '../apps/tag' @import '../apps/browse' @import '../apps/unsubscribe' -@import '../apps/feature/stylesheets' @import '../apps/fair/stylesheets' @import '../apps/fair_info/stylesheets' @import '../apps/page' diff --git a/src/mobile/index.js b/src/mobile/index.js index b21f338fa6d..f10caf4d5f1 100644 --- a/src/mobile/index.js +++ b/src/mobile/index.js @@ -21,7 +21,6 @@ app.use(require("./apps/contact")) app.use(require("./apps/how_auctions_work")) app.use(require("./apps/profile")) app.use(require("./apps/user")) -app.use(require("./apps/feature")) app.use(require("./apps/gene")) app.use(require("./apps/artists")) app.use(require("./apps/partners")) diff --git a/src/typings/sharify.d.ts b/src/typings/sharify.d.ts index 8a44d62ac9e..4202026f00e 100644 --- a/src/typings/sharify.d.ts +++ b/src/typings/sharify.d.ts @@ -20,7 +20,6 @@ declare module "sharify" { readonly APP_URL: string readonly ARTIST_COLLECTIONS_RAIL?: string // TODO: remove after CollectionsRail a/b test readonly ARTIST_COLLECTIONS_RAIL_IDS: string[] - readonly CLIENT_NAVIGATION_V5: "experiment" | "control" // TODO: Remove after A/B test. readonly CMS_URL: string readonly CDN_URL: string CURRENT_PATH: string diff --git a/src/v2/Apps/Artist/Components/ArtistCollectionsRail/ArtistCollectionEntity.tsx b/src/v2/Apps/Artist/Components/ArtistCollectionsRail/ArtistCollectionEntity.tsx index 52e123da519..60dbfd3b9f8 100644 --- a/src/v2/Apps/Artist/Components/ArtistCollectionsRail/ArtistCollectionEntity.tsx +++ b/src/v2/Apps/Artist/Components/ArtistCollectionsRail/ArtistCollectionEntity.tsx @@ -1,4 +1,4 @@ -import { Box, color, Flex, Image, Sans, Serif } from "@artsy/palette" +import { Box, Flex, Image, Sans, Serif, color } from "@artsy/palette" import { ArtistCollectionEntity_collection } from "v2/__generated__/ArtistCollectionEntity_collection.graphql" import { track } from "v2/Artsy/Analytics" import * as Schema from "v2/Artsy/Analytics/Schema" @@ -64,7 +64,7 @@ export class ArtistCollectionEntity extends React.Component { const artistName = get(artworks[i].artist, a => a.name) const alt = `${artistName ? artistName + ", " : ""}${ artworks[i].title - }` + }` return ( @@ -80,13 +80,13 @@ export class ArtistCollectionEntity extends React.Component { ) }) ) : ( - - )} + + )} {formattedTitle} @@ -131,7 +131,7 @@ const SingleImgContainer = styled(Box)` } ` -const ImgOverlay = styled(Box) <{ width: number }>` +const ImgOverlay = styled(Box)<{ width: number }>` height: 125px; background-color: ${color("black30")}; opacity: 0.1; @@ -141,7 +141,7 @@ const ImgOverlay = styled(Box) <{ width: number }>` z-index: 7; ` -export const ArtworkImage = styled(Image) <{ width: number }>` +export const ArtworkImage = styled(Image)<{ width: number }>` width: ${({ width }) => width}px; height: 125px; background-color: ${color("black10")}; diff --git a/src/v2/Apps/Artist/Components/ArtistConsignButton.tsx b/src/v2/Apps/Artist/Components/ArtistConsignButton.tsx index 905d66944f9..a4ce130d716 100644 --- a/src/v2/Apps/Artist/Components/ArtistConsignButton.tsx +++ b/src/v2/Apps/Artist/Components/ArtistConsignButton.tsx @@ -9,10 +9,10 @@ import { BorderBox, Box, Button, - color, Flex, Image, Sans, + color, } from "@artsy/palette" import { AnalyticsSchema, useTracking } from "v2/Artsy" @@ -58,85 +58,85 @@ interface Tracking { export const ArtistConsignButtonLarge: React.FC = props => { - const { showImage, imageURL, headline, consignURL } = getData(props) - - return ( - { - props.trackGetStartedClick({ - destinationPath: consignURL, - }) - }} - > - - - - {showImage && ( - - )} - - - {headline} - - - - Consign with Artsy - - - - - - - - - - - ) - } + const { showImage, imageURL, headline, consignURL } = getData(props) -export const ArtistConsignButtonSmall: React.FC = props => { - const { showImage, imageURL, headline, consignURL } = getData(props) - - return ( - { - props.trackGetStartedClick({ - destinationPath: consignURL, - }) - }} - > - - - {showImage && } + return ( + { + props.trackGetStartedClick({ + destinationPath: consignURL, + }) + }} + > + + + + {showImage && ( + + )} {headline} - + Consign with Artsy - - - - + - - - ) - } + + + + + + + ) +} + +export const ArtistConsignButtonSmall: React.FC = props => { + const { showImage, imageURL, headline, consignURL } = getData(props) + + return ( + { + props.trackGetStartedClick({ + destinationPath: consignURL, + }) + }} + > + + + {showImage && } + + + {headline} + + + + Consign with Artsy + + + + + + + + + + ) +} function getData(props) { const { diff --git a/src/v2/Apps/Artist/Components/ArtistHeader.tsx b/src/v2/Apps/Artist/Components/ArtistHeader.tsx index cf962e1e140..0e1d09c2ada 100644 --- a/src/v2/Apps/Artist/Components/ArtistHeader.tsx +++ b/src/v2/Apps/Artist/Components/ArtistHeader.tsx @@ -1,10 +1,10 @@ -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { Box, Button, Flex, Image, Sans, Serif, Spacer } from "@artsy/palette" import { ArtistHeader_artist } from "v2/__generated__/ArtistHeader_artist.graphql" import { StyledLink } from "v2/Apps/Artist/Components/StyledLink" import { HorizontalPadding } from "v2/Apps/Components/HorizontalPadding" import { Mediator, SystemContextConsumer } from "v2/Artsy" -import { track, Track } from "v2/Artsy/Analytics" +import { Track, track } from "v2/Artsy/Analytics" import * as Schema from "v2/Artsy/Analytics/Schema" import { RouterLink } from "v2/Artsy/Router/RouterLink" import { Carousel } from "v2/Components/Carousel" diff --git a/src/v2/Apps/Artist/Components/ArtistIndicator.tsx b/src/v2/Apps/Artist/Components/ArtistIndicator.tsx index 5d0fa4a5f97..363d284b349 100644 --- a/src/v2/Apps/Artist/Components/ArtistIndicator.tsx +++ b/src/v2/Apps/Artist/Components/ArtistIndicator.tsx @@ -1,4 +1,4 @@ -import { color, Flex, Sans } from "@artsy/palette" +import { Flex, Sans, color } from "@artsy/palette" import React from "react" import { diff --git a/src/v2/Apps/Artist/Components/__stories__/ArtistConsignButton.story.tsx b/src/v2/Apps/Artist/Components/__stories__/ArtistConsignButton.story.tsx index f88ea6d6830..7b6812966bd 100644 --- a/src/v2/Apps/Artist/Components/__stories__/ArtistConsignButton.story.tsx +++ b/src/v2/Apps/Artist/Components/__stories__/ArtistConsignButton.story.tsx @@ -1,5 +1,5 @@ import React from "react" -import { graphql, QueryRenderer } from "react-relay" +import { QueryRenderer, graphql } from "react-relay" import { storiesOf } from "storybook/storiesOf" import { ArtistConsignButtonQuery } from "v2/__generated__/ArtistConsignButtonQuery.graphql" diff --git a/src/v2/Apps/Artist/Routes/Articles/ArtistArticles.tsx b/src/v2/Apps/Artist/Routes/Articles/ArtistArticles.tsx index 1e995627df1..a9b7434fd9c 100644 --- a/src/v2/Apps/Artist/Routes/Articles/ArtistArticles.tsx +++ b/src/v2/Apps/Artist/Routes/Articles/ArtistArticles.tsx @@ -2,7 +2,7 @@ import { Box, Col, Row } from "@artsy/palette" import { ArtistArticles_artist } from "v2/__generated__/ArtistArticles_artist.graphql" import { PaginationFragmentContainer as Pagination } from "v2/Components/Pagination" import React, { Component } from "react" -import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay" +import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay" import styled from "styled-components" import { ArticleItem } from "./ArtistArticle" @@ -24,7 +24,7 @@ interface ArtistArticlesProps { export class ArtistArticles extends Component< ArtistArticlesProps, LoadingAreaState - > { +> { state = { isLoading: false, } diff --git a/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResultItem.tsx b/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResultItem.tsx index 9d40e913e29..9adda6b98db 100644 --- a/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResultItem.tsx +++ b/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResultItem.tsx @@ -34,7 +34,6 @@ export interface Props extends SystemContextProps { mediator?: Mediator lastChild: boolean filtersAtDefault: boolean - paginated: boolean } const FullWidthBorderBox = styled(BorderBox)` @@ -196,8 +195,7 @@ const LargeAuctionItem: SFC = props => { props.user, props.mediator, "lg", - props.filtersAtDefault, - props.paginated + props.filtersAtDefault )} @@ -241,8 +239,7 @@ const ExtraSmallAuctionItem: SFC = props => { props.user, props.mediator, "xs", - props.filtersAtDefault, - props.paginated + props.filtersAtDefault )} {title} @@ -326,16 +323,12 @@ const renderPricing = ( user, mediator, size, - filtersAtDefault, - paginated + filtersAtDefault ) => { const textSize = size === "xs" ? "2" : "3t" - // If user is logged in we show prices. Otherwise we show prices only for the default view - on page 1 and filters not changed. - // Ideally we get current page number from filter context 'page' property but somehow it is always '1'. - // So we resort to pagination detection. If user has paginated at all, prices will be hidden. even if user comes back to page 1. - // TODO: Fix filter context so its 'page' property has the current page number, then change this code. - if (user || (filtersAtDefault && !paginated)) { + // If user is logged in we show prices. Otherwise we show prices only when filters at default. + if (user || filtersAtDefault) { const textAlign = size === "xs" ? "left" : "right" const dateOfSale = DateTime.fromISO(saleDate) const now = DateTime.local() @@ -436,12 +429,11 @@ const renderRealizedPrice = ( user, mediator, size, - filtersAtDefault, - paginated + filtersAtDefault ) => { const justifyContent = size === "xs" ? "flex-start" : "flex-end" - // Show prices if user is logged in. Otherwise, show prices only on default view - filters at default and no pagination has happened. - if (user || (filtersAtDefault && !paginated)) { + // Show prices if user is logged in. Otherwise, show prices only when filters at default. + if (user || filtersAtDefault) { return ( {estimatedPrice && ( @@ -551,8 +543,7 @@ const renderLargeCollapse = (props, user, mediator, filtersAtDefault) => { user, mediator, "lg", - filtersAtDefault, - props.paginated + filtersAtDefault )} @@ -638,8 +629,7 @@ const renderSmallCollapse = (props, user, mediator, filtersAtDefault) => { user, mediator, "xs", - filtersAtDefault, - props.paginated + filtersAtDefault )} diff --git a/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResults.tsx b/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResults.tsx index 9b0da630111..9336d428e87 100644 --- a/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResults.tsx +++ b/src/v2/Apps/Artist/Routes/AuctionResults/ArtistAuctionResults.tsx @@ -6,7 +6,6 @@ import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay" import useDeepCompareEffect from "use-deep-compare-effect" import { AuctionResultItemFragmentContainer as AuctionResultItem } from "./ArtistAuctionResultItem" import { TableSidebar } from "./Components/TableSidebar" - import { ContextModule } from "@artsy/cohesion" import { Box, Spacer } from "@artsy/palette" import { AnalyticsSchema } from "v2/Artsy" @@ -40,56 +39,18 @@ const AuctionResultsContainer: React.FC = ({ relay, }) => { const filterContext = useAuctionResultsFilterContext() - - const { - sort, - organizations, - categories, - sizes, - createdAfterYear, - createdBeforeYear, - allowEmptyCreatedDates, - } = filterContext.filters - - // Detect whether user has paginated at all. - const [paginated, togglePaginated] = useState(false) + const { pageInfo } = artist.auctionResultsConnection + const { hasNextPage, endCursor } = pageInfo const loadNext = () => { - const { hasNextPage, endCursor } = pageInfo - + const nextPageNum = filterContext.filters.pageAndCursor.page + 1 if (hasNextPage) { - loadAfter(endCursor) + loadPage(endCursor, nextPageNum) } } - const loadAfter = cursor => { - setIsLoading(true) - togglePaginated(true) - - relay.refetch( - { - first: PAGE_SIZE, - after: cursor, - artistID: artist.slug, - before: null, - last: null, - organizations, - categories, - sizes, - sort, - createdBeforeYear, - createdAfterYear, - allowEmptyCreatedDates, - }, - null, - error => { - setIsLoading(false) - - if (error) { - logger.error(error) - } - } - ) + const loadPage = (cursor, pageNum) => { + filterContext.setFilter("pageAndCursor", { page: pageNum, cursor: cursor }) } const [isLoading, setIsLoading] = useState(false) @@ -110,6 +71,7 @@ const AuctionResultsContainer: React.FC = ({ ([filterKey, currentFilter]) => { const previousFilter = previousFilters[filterKey] const filtersHaveUpdated = !isEqual(currentFilter, previousFilter) + if (filtersHaveUpdated) { fetchResults() @@ -134,7 +96,7 @@ const AuctionResultsContainer: React.FC = ({ const relayParams = { first: PAGE_SIZE, artistID: artist.slug, - after: null, + after: filterContext.filters.pageAndCursor.cursor, before: null, last: null, } @@ -153,7 +115,6 @@ const AuctionResultsContainer: React.FC = ({ }) } - const { pageInfo } = artist.auctionResultsConnection const auctionResultsLength = artist.auctionResultsConnection.edges.length const resultList = ( @@ -166,7 +127,6 @@ const AuctionResultsContainer: React.FC = ({ auctionResult={node} lastChild={index === auctionResultsLength - 1} filtersAtDefault={filtersAtDefault} - paginated={paginated} /> ) @@ -211,8 +171,8 @@ const AuctionResultsContainer: React.FC = ({ loadPage(_cursor, page)} + onNext={() => loadNext()} scrollTo="#jumpto-ArtistHeader" /> diff --git a/src/v2/Apps/Artist/Routes/AuctionResults/AuctionResultsFilterContext.tsx b/src/v2/Apps/Artist/Routes/AuctionResults/AuctionResultsFilterContext.tsx index d39f65b9584..aaecb125807 100644 --- a/src/v2/Apps/Artist/Routes/AuctionResults/AuctionResultsFilterContext.tsx +++ b/src/v2/Apps/Artist/Routes/AuctionResults/AuctionResultsFilterContext.tsx @@ -4,7 +4,7 @@ export interface AuctionResultsFilters { organizations?: string[] categories?: string[] sizes?: string[] - page?: number + pageAndCursor?: { page: number; cursor: string } sort?: string createdAfterYear?: number createdBeforeYear?: number @@ -26,7 +26,7 @@ export const initialAuctionResultsFilterState: AuctionResultsFilters = { organizations: [], categories: [], sizes: [], - page: 1, + pageAndCursor: { page: 1, cursor: null }, sort: "DATE_DESC", allowEmptyCreatedDates: true, } @@ -157,9 +157,8 @@ const AuctionResultsFilterReducer = ( */ case "SET": { const { name, value } = action.payload - const filterState: AuctionResultsFilters = { - page: 1, + pageAndCursor: { page: 1, cursor: null }, } arrayFilterTypes.forEach(filter => { @@ -171,17 +170,23 @@ const AuctionResultsFilterReducer = ( // primitive filter types const primitiveFilterTypes: Array = [ "sort", - "page", + "pageAndCursor", "createdAfterYear", "createdBeforeYear", "allowEmptyCreatedDates", ] + primitiveFilterTypes.forEach(filter => { if (name === filter) { filterState[name as any] = value } }) + // do not allow a real cursor to be set for page 1. to agree with initial filter state. + if (filterState.pageAndCursor.page === 1) { + filterState.pageAndCursor.cursor = null + } + if (name === "createdBeforeYear" && value) { if (!state.createdAfterYear) { filterState.createdAfterYear = state.earliestCreatedYear @@ -213,7 +218,7 @@ const AuctionResultsFilterReducer = ( const { name } = action.payload as { name: keyof AuctionResultsFilters } const filterState: AuctionResultsFilters = { - page: 1, + pageAndCursor: { page: 1, cursor: null }, } const filters: Array = ["sort"] diff --git a/src/v2/Apps/Artist/Routes/AuctionResults/Components/AuctionFilters/YearCreated.tsx b/src/v2/Apps/Artist/Routes/AuctionResults/Components/AuctionFilters/YearCreated.tsx index 7b3e9da5211..20613444ced 100644 --- a/src/v2/Apps/Artist/Routes/AuctionResults/Components/AuctionFilters/YearCreated.tsx +++ b/src/v2/Apps/Artist/Routes/AuctionResults/Components/AuctionFilters/YearCreated.tsx @@ -42,7 +42,7 @@ export const YearCreated: React.FC = () => { filterContext.setFilter("createdAfterYear", earliestCreatedYear) filterContext.setFilter("createdBeforeYear", latestCreatedYear) }, - [earliestCreatedYear, latestCreatedYear] + [earliestCreatedYear, latestCreatedYear, filterContext] ) if ( diff --git a/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResults.jest.tsx b/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResults.jest.tsx index 16011b750bd..e65599d7238 100644 --- a/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResults.jest.tsx +++ b/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResults.jest.tsx @@ -108,28 +108,25 @@ describe("AuctionResults", () => { ) }) describe("pagination", () => { - it("triggers relay refetch with after", () => { + it("triggers relay refetch with after, and re-shows sign up to see price", done => { const pagination = wrapper.find("Pagination") pagination .find("button") .at(1) .simulate("click") - expect(refetchSpy).toHaveBeenCalledTimes(1) - expect(refetchSpy.mock.calls[0][0]).toEqual( - expect.objectContaining({ - ...defaultRelayParams, - after: "YXJyYXljb25uZWN0aW9uOjk=", - }) - ) - }) - it("re-shows sign up to see price", () => { - const pagination = wrapper.find("Pagination") - pagination - .find("button") - .at(2) - .simulate("click") + setTimeout(() => { + expect(refetchSpy).toHaveBeenCalledTimes(1) + expect(refetchSpy.mock.calls[0][0]).toEqual( + expect.objectContaining({ + ...defaultRelayParams, + after: "YXJyYXljb25uZWN0aW9uOjk=", + }) + ) + done() + }) + wrapper.update() const html = wrapper.html() expect(html).toContain("Sign up to see price") @@ -177,7 +174,7 @@ describe("AuctionResults", () => { changed: { categories: ["Work on Paper"] }, current: { categories: ["Work on Paper"], - page: 1, + pageAndCursor: { page: 1, cursor: null }, sort: "DATE_DESC", organizations: [], sizes: [], @@ -280,7 +277,7 @@ describe("AuctionResults", () => { changed: { sizes: ["MEDIUM"] }, current: { sizes: ["MEDIUM"], - page: 1, + pageAndCursor: { page: 1, cursor: null }, sort: "DATE_DESC", organizations: [], categories: [], diff --git a/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResultsFilterContext.jest.tsx b/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResultsFilterContext.jest.tsx index a332db830df..84ac235a121 100644 --- a/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResultsFilterContext.jest.tsx +++ b/src/v2/Apps/Artist/Routes/AuctionResults/__tests__/AuctionResultsFilterContext.jest.tsx @@ -43,9 +43,12 @@ describe("AuctionResultsFilterContext", () => { it("#setFilter", done => { getWrapper() act(() => { - context.setFilter("page", 10) + context.setFilter("pageAndCursor", { page: 10, cursor: null }) setTimeout(() => { - expect(context.filters.page).toEqual(10) + expect(context.filters.pageAndCursor).toEqual({ + page: 10, + cursor: null, + }) done() }) }) @@ -54,14 +57,17 @@ describe("AuctionResultsFilterContext", () => { it("#setFilter resets pagination", done => { getWrapper({ filters: { - page: 10, + pageAndCursor: { page: 10, cursor: null }, }, }) act(() => { - expect(context.filters.page).toEqual(10) + expect(context.filters.pageAndCursor.page).toEqual(10) context.setFilter("sort", "relevant") setTimeout(() => { - expect(context.filters.page).toEqual(1) + expect(context.filters.pageAndCursor).toEqual({ + page: 1, + cursor: null, + }) done() }) }) @@ -155,13 +161,16 @@ describe("AuctionResultsFilterContext", () => { it("#unsetFilter", done => { getWrapper() act(() => { - context.setFilter("page", 10) + context.setFilter("pageAndCursor", { page: 10, cursor: null }) setTimeout(() => { - expect(context.filters.page).toEqual(10) + expect(context.filters.pageAndCursor.page).toEqual(10) act(() => { - context.unsetFilter("page") + context.unsetFilter("pageAndCursor") setTimeout(() => { - expect(context.filters.page).toEqual(1) + expect(context.filters.pageAndCursor).toEqual({ + page: 1, + cursor: null, + }) done() }) }) @@ -172,15 +181,18 @@ describe("AuctionResultsFilterContext", () => { it("#unsetFilter resets pagination", done => { getWrapper({ filters: { - page: 10, + pageAndCursor: { page: 10, cursor: null }, sort: "relevant", }, }) act(() => { - expect(context.filters.page).toEqual(10) + expect(context.filters.pageAndCursor.page).toEqual(10) context.unsetFilter("sort") setTimeout(() => { - expect(context.filters.page).toEqual(1) + expect(context.filters.pageAndCursor).toEqual({ + page: 1, + cursor: null, + }) done() }) }) diff --git a/src/v2/Apps/Artist/Routes/CV/CVItem.tsx b/src/v2/Apps/Artist/Routes/CV/CVItem.tsx index 78f00f28d87..3afd326461f 100644 --- a/src/v2/Apps/Artist/Routes/CV/CVItem.tsx +++ b/src/v2/Apps/Artist/Routes/CV/CVItem.tsx @@ -12,14 +12,14 @@ import { Sans, Separator, Serif, - space, Spacer, + space, } from "@artsy/palette" import { + RelayPaginationProp, createPaginationContainer, graphql, - RelayPaginationProp, } from "react-relay" import { ShowEntry } from "./ShowEntry" @@ -123,26 +123,26 @@ export class CVItem extends Component { {this.renderEntries(yearGroup, "2")} ) : ( - - {!sm && !md && ( - - {isFirst && ( - - {this.props.category} - - )} - - )} - - - {year} - - - - {this.renderEntries(yearGroup)} + + {!sm && !md && ( + + {isFirst && ( + + {this.props.category} + + )} - - ) + )} + + + {year} + + + + {this.renderEntries(yearGroup)} + + + ) })} {this.hasMore && ( diff --git a/src/v2/Apps/Artist/Routes/Consign/Components/ArtistConsignMarketTrends.tsx b/src/v2/Apps/Artist/Routes/Consign/Components/ArtistConsignMarketTrends.tsx index f2227db8f81..594868fdd51 100644 --- a/src/v2/Apps/Artist/Routes/Consign/Components/ArtistConsignMarketTrends.tsx +++ b/src/v2/Apps/Artist/Routes/Consign/Components/ArtistConsignMarketTrends.tsx @@ -1,4 +1,4 @@ -import { Box, Button, color, Flex, Sans, Serif } from "@artsy/palette" +import { Box, Button, Flex, Sans, Serif, color } from "@artsy/palette" import { AnalyticsSchema, useTracking } from "v2/Artsy" import { RouterLink } from "v2/Artsy/Router/RouterLink" import React from "react" diff --git a/src/v2/Apps/Artist/Routes/Consign/Components/SectionContainer.tsx b/src/v2/Apps/Artist/Routes/Consign/Components/SectionContainer.tsx index 8aa73107277..32e130c78ea 100644 --- a/src/v2/Apps/Artist/Routes/Consign/Components/SectionContainer.tsx +++ b/src/v2/Apps/Artist/Routes/Consign/Components/SectionContainer.tsx @@ -1,4 +1,4 @@ -import { Color, color, Flex, FlexProps } from "@artsy/palette" +import { Color, Flex, FlexProps, color } from "@artsy/palette" import React from "react" // Doesn't exist in design system diff --git a/src/v2/Apps/Artist/Routes/Overview/Components/ArtistArtworkFilter.tsx b/src/v2/Apps/Artist/Routes/Overview/Components/ArtistArtworkFilter.tsx index 161000c5342..3f9d0ea9c01 100644 --- a/src/v2/Apps/Artist/Routes/Overview/Components/ArtistArtworkFilter.tsx +++ b/src/v2/Apps/Artist/Routes/Overview/Components/ArtistArtworkFilter.tsx @@ -5,7 +5,7 @@ import { ArtworkFilterContextProvider } from "v2/Components/v2/ArtworkFilter/Art import { updateUrl } from "v2/Components/v2/ArtworkFilter/Utils/urlBuilder" import { Match, RouterState, withRouter } from "found" import React from "react" -import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay" +import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay" import { ZeroState } from "./ZeroState" interface ArtistArtworkFilterProps { diff --git a/src/v2/Apps/Artist/Routes/Overview/Components/ArtistRecommendations.tsx b/src/v2/Apps/Artist/Routes/Overview/Components/ArtistRecommendations.tsx index f36704df705..a8df5ba2cdf 100644 --- a/src/v2/Apps/Artist/Routes/Overview/Components/ArtistRecommendations.tsx +++ b/src/v2/Apps/Artist/Routes/Overview/Components/ArtistRecommendations.tsx @@ -7,9 +7,9 @@ import { renderWithLoadProgress } from "v2/Artsy/Relay/renderWithLoadProgress" import { SystemQueryRenderer as QueryRenderer } from "v2/Artsy/Relay/SystemQueryRenderer" import React, { useContext, useState } from "react" import { + RelayPaginationProp, createPaginationContainer, graphql, - RelayPaginationProp, } from "react-relay" import { get } from "v2/Utils/get" import createLogger from "v2/Utils/logger" diff --git a/src/v2/Apps/Artist/Routes/Overview/Components/RecommendedArtist.tsx b/src/v2/Apps/Artist/Routes/Overview/Components/RecommendedArtist.tsx index f697a17a4f5..70738826cd2 100644 --- a/src/v2/Apps/Artist/Routes/Overview/Components/RecommendedArtist.tsx +++ b/src/v2/Apps/Artist/Routes/Overview/Components/RecommendedArtist.tsx @@ -1,4 +1,4 @@ -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { Box, EntityHeader, Sans, Spacer } from "@artsy/palette" import { RecommendedArtist_artist } from "v2/__generated__/RecommendedArtist_artist.graphql" import { SystemContext } from "v2/Artsy" @@ -30,7 +30,7 @@ const handleOpenAuth = (mediator, artist) => { context_module: Schema.ContextModule.RecommendedArtists, }) class RecommendedArtistWithTracking extends React.Component< -RecommendedArtistProps + RecommendedArtistProps > { @track({ type: Schema.Type.Thumbnail, diff --git a/src/v2/Apps/Artist/Routes/Overview/Components/ZeroState.tsx b/src/v2/Apps/Artist/Routes/Overview/Components/ZeroState.tsx index 052f0232e66..32a31f32a2a 100644 --- a/src/v2/Apps/Artist/Routes/Overview/Components/ZeroState.tsx +++ b/src/v2/Apps/Artist/Routes/Overview/Components/ZeroState.tsx @@ -1,4 +1,4 @@ -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { Link, Message } from "@artsy/palette" import { useSystemContext } from "v2/Artsy" import { FollowArtistButtonFragmentContainer as FollowArtistButton } from "v2/Components/FollowButton/FollowArtistButton" diff --git a/src/v2/Apps/Artist/Routes/Overview/index.tsx b/src/v2/Apps/Artist/Routes/Overview/index.tsx index d22f3c7cab3..2f6a1a92b23 100644 --- a/src/v2/Apps/Artist/Routes/Overview/index.tsx +++ b/src/v2/Apps/Artist/Routes/Overview/index.tsx @@ -28,7 +28,7 @@ import { StyledLink } from "v2/Apps/Artist/Components/StyledLink" import { WorksForSaleRailQueryRenderer as WorksForSaleRail } from "v2/Apps/Artist/Routes/Overview/Components/WorksForSaleRail" import { pMedia } from "v2/Components/Helpers" import React from "react" -import { createFragmentContainer, graphql, RelayRefetchProp } from "react-relay" +import { RelayRefetchProp, createFragmentContainer, graphql } from "react-relay" import { Track, TrackingProp } from "react-tracking" import styled from "styled-components" import { get } from "v2/Utils/get" diff --git a/src/v2/Apps/Artist/Routes/Shows/ArtistShows.tsx b/src/v2/Apps/Artist/Routes/Shows/ArtistShows.tsx index 0d6a159fa86..c0c77e20dc0 100644 --- a/src/v2/Apps/Artist/Routes/Shows/ArtistShows.tsx +++ b/src/v2/Apps/Artist/Routes/Shows/ArtistShows.tsx @@ -2,7 +2,7 @@ import { Box, Col, Flex, Row, Sans, Spacer } from "@artsy/palette" import { ArtistShows_artist } from "v2/__generated__/ArtistShows_artist.graphql" import { PaginationFragmentContainer as Pagination } from "v2/Components/Pagination" import React, { Component } from "react" -import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay" +import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay" import { get } from "v2/Utils/get" import { Media } from "v2/Utils/Responsive" import { ArtistShowBlockItem } from "./ArtistShowBlockItem" @@ -126,29 +126,29 @@ class ArtistShows extends Component { )} ) : ( - - {this.props.artist.showsConnection.edges.map( - ({ node }, index) => { - return ( - - + + {this.props.artist.showsConnection.edges.map( + ({ node }, index) => { + return ( + + - - - - - ) - } - )} - - )} + + + + + ) + } + )} + + )} diff --git a/src/v2/Apps/Artist/routes.tsx b/src/v2/Apps/Artist/routes.tsx index 8f4639272e1..e980d439671 100644 --- a/src/v2/Apps/Artist/routes.tsx +++ b/src/v2/Apps/Artist/routes.tsx @@ -135,7 +135,6 @@ export const routes: RouteConfig[] = [ OverviewRoute.preload() }, displayNavigationTabs: true, - ignoreScrollBehavior: true, query: graphql` query routes_OverviewQuery($artistID: String!) @raw_response_type { artist(id: $artistID) { diff --git a/src/v2/Apps/Artwork/ArtworkApp.tsx b/src/v2/Apps/Artwork/ArtworkApp.tsx index 34c300d2c15..ece96b3fcfc 100644 --- a/src/v2/Apps/Artwork/ArtworkApp.tsx +++ b/src/v2/Apps/Artwork/ArtworkApp.tsx @@ -90,11 +90,6 @@ export class ArtworkApp extends React.Component { // See trackingMiddleware.ts window.analytics.__artsyReferrer = referrer window.analytics.page(properties, { integrations: { Marketo: false } }) - - // TODO: Remove after EXPERIMENTAL_APP_SHELL AB test ends. - // if (sd.CLIENT_NAVIGATION_V5) { - // trackExperimentViewed("client_navigation_v5", properties) - // } } } diff --git a/src/v2/Apps/Artwork/Components/ArtworkDetails/ArtworkDetailsAboutTheWorkFromPartner.tsx b/src/v2/Apps/Artwork/Components/ArtworkDetails/ArtworkDetailsAboutTheWorkFromPartner.tsx index a890bd199e7..a5fe47a1431 100644 --- a/src/v2/Apps/Artwork/Components/ArtworkDetails/ArtworkDetailsAboutTheWorkFromPartner.tsx +++ b/src/v2/Apps/Artwork/Components/ArtworkDetails/ArtworkDetailsAboutTheWorkFromPartner.tsx @@ -15,7 +15,7 @@ import { track } from "v2/Artsy/Analytics" import * as Schema from "v2/Artsy/Analytics/Schema" import Events from "v2/Utils/Events" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { Box, EntityHeader, @@ -41,7 +41,7 @@ export interface ArtworkDetailsAboutTheWorkFromPartnerProps { } ) export class ArtworkDetailsAboutTheWorkFromPartner extends React.Component< -ArtworkDetailsAboutTheWorkFromPartnerProps + ArtworkDetailsAboutTheWorkFromPartnerProps > { @track({ action_type: Schema.ActionType.Click, diff --git a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkActions.tsx b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkActions.tsx index 8d99a171e60..a4370823bc7 100644 --- a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkActions.tsx +++ b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkActions.tsx @@ -17,7 +17,6 @@ import { ContextModule } from "@artsy/cohesion" import { BellFillIcon, BellIcon, - color, DownloadIcon, EditIcon, Flex, @@ -31,6 +30,7 @@ import { Sans, ShareIcon, Spacer, + color, } from "@artsy/palette" import { userIsAdmin } from "v2/Utils/user" import { ArtworkPopoutPanel } from "./ArtworkPopoutPanel" @@ -49,8 +49,8 @@ interface ArtworkActionsState { @track() export class ArtworkActions extends React.Component< -ArtworkActionsProps, -ArtworkActionsState + ArtworkActionsProps, + ArtworkActionsState > { state = { showSharePanel: false, @@ -311,14 +311,14 @@ export const ArtworkActionsFragmentContainer = createFragmentContainer( interface UtilButtonProps { name: - | "bell" - | "edit" - | "download" - | "genome" - | "heart" - | "more" - | "share" - | "viewInRoom" + | "bell" + | "edit" + | "download" + | "genome" + | "heart" + | "more" + | "share" + | "viewInRoom" href?: string onClick?: () => void selected?: boolean @@ -329,7 +329,7 @@ interface UtilButtonProps { export class UtilButton extends React.Component< UtilButtonProps, { hovered: boolean } - > { +> { state = { hovered: false, } @@ -391,15 +391,15 @@ export class UtilButton extends React.Component< )} ) : ( - <> - - {label && ( - - {label} - - )} - - )} + <> + + {label && ( + + {label} + + )} + + )} ) } diff --git a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkImageBrowser.tsx b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkImageBrowser.tsx index 9be238ae6bb..6ad7a48c2c4 100644 --- a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkImageBrowser.tsx +++ b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkImageBrowser.tsx @@ -6,7 +6,7 @@ import React from "react" import styled from "styled-components" import { Media } from "v2/Utils/Responsive" -import { Box, ChevronIcon, Col, color, Flex, space } from "@artsy/palette" +import { Box, ChevronIcon, Col, Flex, color, space } from "@artsy/palette" interface ArtworkBrowserProps { imageAlt: string @@ -31,7 +31,7 @@ export const ArtworkImageBrowser = (props: ArtworkBrowserProps) => { export class LargeArtworkImageBrowser extends React.Component< ArtworkBrowserProps - > { +> { render() { const hasMultipleImages = this.props.images.length > 1 const { imageAlt, images, setCarouselRef } = this.props @@ -116,7 +116,7 @@ export class LargeArtworkImageBrowser extends React.Component< export class SmallArtworkImageBrowser extends React.Component< ArtworkBrowserProps - > { +> { render() { const { images, imageAlt, setCarouselRef } = this.props // FIXME: During SSR pass want to hide other images. Work around for lack diff --git a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkPopoutPanel.tsx b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkPopoutPanel.tsx index 9c3d58142be..a2ec9f47798 100644 --- a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkPopoutPanel.tsx +++ b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkPopoutPanel.tsx @@ -1,4 +1,4 @@ -import { Box, color, Flex, Sans, space } from "@artsy/palette" +import { Box, Flex, Sans, color, space } from "@artsy/palette" import Icon from "v2/Components/Icon" import React from "react" import styled from "styled-components" @@ -10,7 +10,7 @@ interface ArtworkPopoutPanelProps { export class ArtworkPopoutPanel extends React.Component< ArtworkPopoutPanelProps - > { +> { render() { return ( diff --git a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkSharePanel.tsx b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkSharePanel.tsx index c43dedf8053..1d0c4965ac0 100644 --- a/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkSharePanel.tsx +++ b/src/v2/Apps/Artwork/Components/ArtworkImageBrowser/ArtworkSharePanel.tsx @@ -1,4 +1,4 @@ -import { color, Flex, media, Sans, Separator } from "@artsy/palette" +import { Flex, Sans, Separator, color, media } from "@artsy/palette" import { ArtworkSharePanel_artwork } from "v2/__generated__/ArtworkSharePanel_artwork.graphql" import Icon from "v2/Components/Icon" import React from "react" @@ -30,7 +30,7 @@ const COPY_LABELS = { export class ArtworkSharePanel extends React.Component< ArtworkSharePanelProps, ArtworkSharePanelState - > { +> { private input: HTMLInputElement state = { diff --git a/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarArtists.tsx b/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarArtists.tsx index 662e8f0646c..0c39d1c1f51 100644 --- a/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarArtists.tsx +++ b/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarArtists.tsx @@ -6,7 +6,7 @@ import { FollowIcon } from "v2/Components/FollowIcon" import React from "react" import { createFragmentContainer, graphql } from "react-relay" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { ArtworkSidebarArtists_artwork } from "v2/__generated__/ArtworkSidebarArtists_artwork.graphql" import { FollowArtistButtonFragmentContainer as FollowArtistButton } from "v2/Components/FollowButton/FollowArtistButton" import { openAuthToFollowSave } from "v2/Utils/openAuthModal" @@ -24,10 +24,10 @@ export class ArtworkSidebarArtists extends React.Component { {artist.name} ) : ( - - {artist.name} - - ) + + {artist.name} + + ) } handleOpenAuth = (mediator, artist) => { diff --git a/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarCommercial.tsx b/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarCommercial.tsx index 2cf5f7273b1..9a31ac536e6 100644 --- a/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarCommercial.tsx +++ b/src/v2/Apps/Artwork/Components/ArtworkSidebar/ArtworkSidebarCommercial.tsx @@ -1,4 +1,4 @@ -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { Box, Button, @@ -23,10 +23,10 @@ import currency from "currency.js" import { Router } from "found" import React, { FC, useContext } from "react" import { + RelayProp, commitMutation, createFragmentContainer, graphql, - RelayProp, } from "react-relay" import { ErrorWithMetadata } from "v2/Utils/errors" import { get } from "v2/Utils/get" @@ -41,7 +41,6 @@ export interface ArtworkSidebarCommercialContainerProps mediator: Mediator router?: Router user: User - EXPERIMENTAL_APP_SHELL?: boolean } export interface ArtworkSidebarCommercialContainerState { @@ -51,7 +50,7 @@ export interface ArtworkSidebarCommercialContainerState { selectedEditionSet: EditionSet } -const Row: React.SFC = ({ children, ...others }) => ( +const Row: React.FC = ({ children, ...others }) => ( {children} @@ -63,8 +62,8 @@ const logger = createLogger( @track() export class ArtworkSidebarCommercialContainer extends React.Component< -ArtworkSidebarCommercialContainerProps, -ArtworkSidebarCommercialContainerState + ArtworkSidebarCommercialContainerProps, + ArtworkSidebarCommercialContainerState > { state: ArtworkSidebarCommercialContainerState = { isCommittingCreateOrderMutation: false, @@ -235,13 +234,7 @@ ArtworkSidebarCommercialContainerState ) } else { const url = `/orders/${orderOrError.order.internalID}` - - // FIXME: Remove once A/B test completes - if (this.props.EXPERIMENTAL_APP_SHELL) { - this.props.router.push(url) - } else { - window.location.assign(url) - } + this.props.router.push(url) } } ) @@ -326,13 +319,7 @@ ArtworkSidebarCommercialContainerState ) } else { const url = `/orders/${orderOrError.order.internalID}/offer` - - // FIXME: Remove once A/B test completes - if (this.props.EXPERIMENTAL_APP_SHELL) { - this.props.router.push(url) - } else { - window.location.assign(url) - } + this.props.router.push(url) } } ) @@ -378,16 +365,16 @@ ArtworkSidebarCommercialContainerState ) ) : ( - <> - {this.renderEditionSets(artworkEcommerceAvailable)} - {selectedEditionSet && ( - <> - - {this.renderSaleMessage(selectedEditionSet.sale_message)} - - )} - - )} + <> + {this.renderEditionSets(artworkEcommerceAvailable)} + {selectedEditionSet && ( + <> + + {this.renderSaleMessage(selectedEditionSet.sale_message)} + + )} + + )} {artworkEcommerceAvailable && (artwork.shippingOrigin || artwork.shippingInfo) && } @@ -408,12 +395,12 @@ ArtworkSidebarCommercialContainerState )} {artwork.is_inquireable || - artwork.is_acquireable || - artwork.is_offerable ? ( - artwork.sale_message && - ) : ( - - )} + artwork.is_acquireable || + artwork.is_offerable ? ( + artwork.sale_message && + ) : ( + + )} {artwork.is_acquireable && ( @@ -54,8 +54,8 @@ const logger = createLogger("Order/Routes/NewPayment/index.tsx") @track() export class NewPaymentRoute extends Component< -NewPaymentProps, -NewPaymentState + NewPaymentProps, + NewPaymentState > { paymentPicker = React.createRef() state = { @@ -295,7 +295,7 @@ NewPaymentState artistId() { return get( this.props.order, - o => o.lineItems.edges[0].node.artwork.artists[0].slug + (o) => o.lineItems.edges[0].node.artwork.artists[0].slug ) } @@ -347,6 +347,3 @@ export const NewPaymentFragmentContainer = createFragmentContainer( `, } ) - -// For bundle splitting in router -export default NewPaymentFragmentContainer diff --git a/src/v2/Apps/Order/Routes/Offer/index.tsx b/src/v2/Apps/Order/Routes/Offer/index.tsx index c69d220207a..c7fdc36be89 100644 --- a/src/v2/Apps/Order/Routes/Offer/index.tsx +++ b/src/v2/Apps/Order/Routes/Offer/index.tsx @@ -26,10 +26,10 @@ import { track } from "v2/Artsy/Analytics" import * as Schema from "v2/Artsy/Analytics" import { Router } from "found" import React, { Component } from "react" -import { createFragmentContainer, graphql, RelayProp } from "react-relay" +import { RelayProp, createFragmentContainer, graphql } from "react-relay" import createLogger from "v2/Utils/logger" import { Media } from "v2/Utils/Responsive" -import { offerFlowSteps, OrderStepper } from "../../Components/OrderStepper" +import { OrderStepper, offerFlowSteps } from "../../Components/OrderStepper" export interface OfferProps { order: Offer_order @@ -337,6 +337,3 @@ export const OfferFragmentContainer = createFragmentContainer( `, } ) - -// For bundle splitting in router -export default OfferFragmentContainer diff --git a/src/v2/Apps/Order/Routes/Payment/index.tsx b/src/v2/Apps/Order/Routes/Payment/index.tsx index 0d20c2d5bfd..82d81862053 100644 --- a/src/v2/Apps/Order/Routes/Payment/index.tsx +++ b/src/v2/Apps/Order/Routes/Payment/index.tsx @@ -5,9 +5,9 @@ import { PaymentRouteSetOrderPaymentMutation } from "v2/__generated__/PaymentRou import { HorizontalPadding } from "v2/Apps/Components/HorizontalPadding" import { ArtworkSummaryItemFragmentContainer as ArtworkSummaryItem } from "v2/Apps/Order/Components/ArtworkSummaryItem" import { + OrderStepper, buyNowFlowSteps, offerFlowSteps, - OrderStepper, } from "v2/Apps/Order/Components/OrderStepper" import { TransactionDetailsSummaryItemFragmentContainer as TransactionDetailsSummaryItem } from "v2/Apps/Order/Components/TransactionDetailsSummaryItem" import { TwoColumnLayout } from "v2/Apps/Order/Components/TwoColumnLayout" @@ -241,6 +241,3 @@ export const PaymentFragmentContainer = createFragmentContainer( `, } ) - -// For bundle splitting in router -export default PaymentFragmentContainer diff --git a/src/v2/Apps/Order/Routes/Reject/index.tsx b/src/v2/Apps/Order/Routes/Reject/index.tsx index cf506e14b52..d4be5712388 100644 --- a/src/v2/Apps/Order/Routes/Reject/index.tsx +++ b/src/v2/Apps/Order/Routes/Reject/index.tsx @@ -14,8 +14,8 @@ import { Media } from "v2/Utils/Responsive" import { logger } from "../Respond" import { - counterofferFlowSteps, OrderStepper, + counterofferFlowSteps, } from "v2/Apps/Order/Components/OrderStepper" import { Dialog, injectDialog } from "v2/Apps/Order/Dialogs" @@ -23,7 +23,7 @@ import { CommitMutation, injectCommitMutation, } from "v2/Apps/Order/Utils/commitMutation" -import { createFragmentContainer, graphql, RelayProp } from "react-relay" +import { RelayProp, createFragmentContainer, graphql } from "react-relay" interface RejectProps { order: Reject_order @@ -211,6 +211,3 @@ export const RejectFragmentContainer = createFragmentContainer( `, } ) - -// For bundle splitting in router -export default RejectFragmentContainer diff --git a/src/v2/Apps/Order/Routes/Respond/index.tsx b/src/v2/Apps/Order/Routes/Respond/index.tsx index d9a08ba3b25..e12fe6fa013 100644 --- a/src/v2/Apps/Order/Routes/Respond/index.tsx +++ b/src/v2/Apps/Order/Routes/Respond/index.tsx @@ -28,15 +28,15 @@ import * as Schema from "v2/Artsy/Analytics/Schema" import { CountdownTimer } from "v2/Components/CountdownTimer" import { Router } from "found" import React, { Component } from "react" -import { createFragmentContainer, graphql, RelayProp } from "react-relay" +import { RelayProp, createFragmentContainer, graphql } from "react-relay" import createLogger from "v2/Utils/logger" import { Media } from "v2/Utils/Responsive" import { ArtworkSummaryItemFragmentContainer as ArtworkSummaryItem } from "../../Components/ArtworkSummaryItem" import { CreditCardSummaryItemFragmentContainer as CreditCardSummaryItem } from "../../Components/CreditCardSummaryItem" import { OfferHistoryItemFragmentContainer as OfferHistoryItem } from "../../Components/OfferHistoryItem" import { - counterofferFlowSteps, OrderStepper, + counterofferFlowSteps, } from "../../Components/OrderStepper" import { ShippingSummaryItemFragmentContainer as ShippingSummaryItem } from "../../Components/ShippingSummaryItem" @@ -393,6 +393,3 @@ export const RespondFragmentContainer = createFragmentContainer( `, } ) - -// For bundle splitting in router -export default RespondFragmentContainer diff --git a/src/v2/Apps/Order/Routes/Review/index.tsx b/src/v2/Apps/Order/Routes/Review/index.tsx index 5ccc674de64..aa51f611064 100644 --- a/src/v2/Apps/Order/Routes/Review/index.tsx +++ b/src/v2/Apps/Order/Routes/Review/index.tsx @@ -7,9 +7,9 @@ import { ArtworkSummaryItemFragmentContainer as ArtworkSummaryItem } from "v2/Ap import { ConditionsOfSaleDisclaimer } from "v2/Apps/Order/Components/ConditionsOfSaleDisclaimer" import { ItemReviewFragmentContainer as ItemReview } from "v2/Apps/Order/Components/ItemReview" import { + OrderStepper, buyNowFlowSteps, offerFlowSteps, - OrderStepper, } from "v2/Apps/Order/Components/OrderStepper" import { ShippingSummaryItemFragmentContainer as ShippingSummaryItem } from "v2/Apps/Order/Components/ShippingSummaryItem" import { TransactionDetailsSummaryItemFragmentContainer as TransactionDetailsSummaryItem } from "v2/Apps/Order/Components/TransactionDetailsSummaryItem" @@ -22,7 +22,7 @@ import { track } from "v2/Artsy/Analytics" import * as Schema from "v2/Artsy/Analytics/Schema" import { RouteConfig, Router } from "found" import React, { Component } from "react" -import { createFragmentContainer, graphql, RelayProp } from "react-relay" +import { RelayProp, createFragmentContainer, graphql } from "react-relay" import { data as sd } from "sharify" import { get } from "v2/Utils/get" import createLogger from "v2/Utils/logger" @@ -85,7 +85,7 @@ export class ReviewRoute extends Component { this.props.order.mode === "BUY" ? (await this.submitBuyOrder()).commerceSubmitOrder.orderOrError : (await this.submitOffer(setupIntentId)).commerceSubmitOrderWithOffer - .orderOrError + .orderOrError if (orderOrError.error) { this.handleSubmitError(orderOrError.error) @@ -448,6 +448,3 @@ export const ReviewFragmentContainer = createFragmentContainer( `, } ) - -// For bundle splitting in router -export default ReviewFragmentContainer diff --git a/src/v2/Apps/Order/Routes/Shipping/index.tsx b/src/v2/Apps/Order/Routes/Shipping/index.tsx index d4f390590df..fe494671f15 100644 --- a/src/v2/Apps/Order/Routes/Shipping/index.tsx +++ b/src/v2/Apps/Order/Routes/Shipping/index.tsx @@ -17,9 +17,9 @@ import { import { HorizontalPadding } from "v2/Apps/Components/HorizontalPadding" import { ArtworkSummaryItemFragmentContainer as ArtworkSummaryItem } from "v2/Apps/Order/Components/ArtworkSummaryItem" import { + OrderStepper, buyNowFlowSteps, offerFlowSteps, - OrderStepper, } from "v2/Apps/Order/Components/OrderStepper" import { PhoneNumber, @@ -49,7 +49,7 @@ import { import { Router } from "found" import { pick } from "lodash" import React, { Component } from "react" -import { createFragmentContainer, graphql, RelayProp } from "react-relay" +import { RelayProp, createFragmentContainer, graphql } from "react-relay" import { get } from "v2/Utils/get" import createLogger from "v2/Utils/logger" import { Media } from "v2/Utils/Responsive" @@ -79,7 +79,7 @@ const logger = createLogger("Order/Routes/Shipping/index.tsx") export class ShippingRoute extends Component { state: ShippingState = { shippingOption: (this.props.order.requestedFulfillment && - this.props.order.requestedFulfillment.__typename !== "CommerceShip" + this.props.order.requestedFulfillment.__typename !== "CommerceShip" ? "PICKUP" : "SHIP") as CommerceOrderFulfillmentTypeEnum, address: this.startingAddress, @@ -87,8 +87,8 @@ export class ShippingRoute extends Component { addressTouched: {}, phoneNumber: this.props.order.requestedFulfillment && - (this.props.order.requestedFulfillment.__typename === "CommerceShip" || - this.props.order.requestedFulfillment.__typename === "CommercePickup") + (this.props.order.requestedFulfillment.__typename === "CommerceShip" || + this.props.order.requestedFulfillment.__typename === "CommercePickup") ? this.props.order.requestedFulfillment.phoneNumber : "", phoneNumberError: "", @@ -508,6 +508,3 @@ export const ShippingFragmentContainer = createFragmentContainer( `, } ) - -// For bundle splitting in router -export default ShippingFragmentContainer diff --git a/src/v2/Apps/Order/Routes/Status/index.tsx b/src/v2/Apps/Order/Routes/Status/index.tsx index fa4609b2e73..5752707feee 100644 --- a/src/v2/Apps/Order/Routes/Status/index.tsx +++ b/src/v2/Apps/Order/Routes/Status/index.tsx @@ -2,11 +2,11 @@ import { Button, Flex, Join, - media, Message, Sans, Serif, Spacer, + media, } from "@artsy/palette" import { Status_order } from "v2/__generated__/Status_order.graphql" import { HorizontalPadding } from "v2/Apps/Components/HorizontalPadding" @@ -53,26 +53,26 @@ export class StatusRoute extends Component { case "SUBMITTED": return isOfferFlow ? { - title: "Your offer has been submitted", - description: ( - <> - The seller will respond to your offer by {stateExpiresAt}. + title: "Your offer has been submitted", + description: ( + <> + The seller will respond to your offer by {stateExpiresAt}. Keep in mind making an offer doesn’t guarantee you the work. - - ), - } + + ), + } : { - title: "Your order has been submitted", - description: ( - <> - Thank you for your purchase. You will receive a confirmation + title: "Your order has been submitted", + description: ( + <> + Thank you for your purchase. You will receive a confirmation email by {stateExpiresAt}. -
+
Disruptions caused by COVID-19 may cause delays — we appreciate your understanding. - - ), - } + + ), + } case "APPROVED": return { title: isOfferFlow ? "Offer accepted" : "Your order is confirmed", @@ -85,25 +85,25 @@ export class StatusRoute extends Component { your understanding. ) : ( - <> - Thank you for your purchase. A specialist will contact you within - 2 business days to coordinate pickup. -
+ <> + Thank you for your purchase. A specialist will contact you within + 2 business days to coordinate pickup. +
Disruptions caused by COVID-19 may cause delays — we appreciate your understanding. - - ), + + ), } case "FULFILLED": { return isShip ? { - title: "Your order has shipped", - description: this.getFulfilmentDescription(), - } + title: "Your order has shipped", + description: this.getFulfilmentDescription(), + } : { - title: "Your order has been picked up", - description: null, - } + title: "Your order has been picked up", + description: null, + } } case "CANCELED": case "REFUNDED": @@ -272,16 +272,16 @@ export class StatusRoute extends Component { /> ) : ( - - )} + + )} } @@ -373,6 +373,3 @@ export const StatusFragmentContainer = createFragmentContainer(StatusRoute, { } `, }) - -// For bundle splitting in router -export default StatusFragmentContainer diff --git a/src/v2/Apps/Order/Routes/__tests__/Accept.jest.tsx b/src/v2/Apps/Order/Routes/__tests__/Accept.jest.tsx index c50c0079e5a..9a20165e51b 100644 --- a/src/v2/Apps/Order/Routes/__tests__/Accept.jest.tsx +++ b/src/v2/Apps/Order/Routes/__tests__/Accept.jest.tsx @@ -2,8 +2,8 @@ import { AcceptTestQueryRawResponse } from "v2/__generated__/AcceptTestQuery.gra import { Buyer, OfferOrderWithShippingDetails, - Offers, OfferWithTotals, + Offers, } from "v2/Apps/__tests__/Fixtures/Order" import { createTestEnv } from "v2/DevTools/createTestEnv" import { DateTime } from "luxon" diff --git a/src/v2/Apps/Order/Routes/__tests__/Counter.jest.tsx b/src/v2/Apps/Order/Routes/__tests__/Counter.jest.tsx index c7144cf31e9..87ae3e69ba3 100644 --- a/src/v2/Apps/Order/Routes/__tests__/Counter.jest.tsx +++ b/src/v2/Apps/Order/Routes/__tests__/Counter.jest.tsx @@ -1,8 +1,8 @@ import { CounterTestQueryRawResponse } from "v2/__generated__/CounterTestQuery.graphql" import { OfferOrderWithShippingDetails, - Offers, OfferWithTotals, + Offers, } from "v2/Apps/__tests__/Fixtures/Order" import { createTestEnv } from "v2/DevTools/createTestEnv" import { DateTime } from "luxon" diff --git a/src/v2/Apps/Order/Routes/__tests__/Respond.jest.tsx b/src/v2/Apps/Order/Routes/__tests__/Respond.jest.tsx index 3da20e1a1af..e7a3ef99435 100644 --- a/src/v2/Apps/Order/Routes/__tests__/Respond.jest.tsx +++ b/src/v2/Apps/Order/Routes/__tests__/Respond.jest.tsx @@ -4,8 +4,8 @@ import { Buyer, OfferOrderWithShippingDetails, OfferOrderWithShippingDetailsAndNote, - Offers, OfferWithTotals, + Offers, } from "v2/Apps/__tests__/Fixtures/Order" import { OfferHistoryItemFragmentContainer } from "v2/Apps/Order/Components/OfferHistoryItem" import { DateTime } from "luxon" diff --git a/src/v2/Apps/Order/Routes/__tests__/Utils/OrderAppTestPage.tsx b/src/v2/Apps/Order/Routes/__tests__/Utils/OrderAppTestPage.tsx index 003320b5563..657b2a0ec8e 100644 --- a/src/v2/Apps/Order/Routes/__tests__/Utils/OrderAppTestPage.tsx +++ b/src/v2/Apps/Order/Routes/__tests__/Utils/OrderAppTestPage.tsx @@ -9,7 +9,7 @@ import { ShippingSummaryItemFragmentContainer } from "v2/Apps/Order/Components/S import { TransactionDetailsSummaryItem } from "v2/Apps/Order/Components/TransactionDetailsSummaryItem" import { CountdownTimer } from "v2/Components/CountdownTimer" import { ModalButton, ModalDialog } from "v2/Components/Modal/ModalDialog" -import { expectOne, RootTestPage } from "v2/DevTools/RootTestPage" +import { RootTestPage, expectOne } from "v2/DevTools/RootTestPage" export class OrderAppTestPage extends RootTestPage { /** COMPONENT SELECTORS **/ diff --git a/src/v2/Apps/Order/Utils/commitMutation.tsx b/src/v2/Apps/Order/Utils/commitMutation.tsx index 09fc5d6128a..1f5213f8d7f 100644 --- a/src/v2/Apps/Order/Utils/commitMutation.tsx +++ b/src/v2/Apps/Order/Utils/commitMutation.tsx @@ -1,8 +1,8 @@ import { SystemContext } from "v2/Artsy" import React, { useContext } from "react" import { - commitMutation as relayCommitMutation, GraphQLTaggedNode, + commitMutation as relayCommitMutation, } from "react-relay" import { Environment } from "relay-runtime" @@ -32,7 +32,7 @@ const MutationContext = React.createContext({ class ProvideMutationContext extends React.Component< { relayEnvironment: Environment }, { isCommittingMutation: boolean } - > { +> { execQueue: Array<() => Promise> = [] state = { isCommittingMutation: false } commitMutation: CommitMutation = ({ variables, mutation }) => { diff --git a/src/v2/Apps/Order/__tests__/getRedirect.jest.ts b/src/v2/Apps/Order/__tests__/getRedirect.jest.ts index e484e42eebb..b92aebc0663 100644 --- a/src/v2/Apps/Order/__tests__/getRedirect.jest.ts +++ b/src/v2/Apps/Order/__tests__/getRedirect.jest.ts @@ -1,4 +1,4 @@ -import { getRedirect, RedirectRecord } from "../getRedirect" +import { RedirectRecord, getRedirect } from "../getRedirect" describe("getRedirect", () => { const aNonMatchingPredicate = ({}) => null diff --git a/src/v2/Apps/Order/routes.tsx b/src/v2/Apps/Order/routes.tsx index 4d4130f1d30..75abec965f6 100644 --- a/src/v2/Apps/Order/routes.tsx +++ b/src/v2/Apps/Order/routes.tsx @@ -6,17 +6,18 @@ import { Redirect, RedirectException, RouteConfig } from "found" import * as React from "react" import { graphql } from "react-relay" +import { RespondFragmentContainer as RespondRoute } from "./Routes/Respond" +import { OfferFragmentContainer as OfferRoute } from "./Routes/Offer" +import { ShippingFragmentContainer as ShippingRoute } from "./Routes/Shipping" +import { PaymentFragmentContainer as PaymentRoute } from "./Routes/Payment" +import { NewPaymentFragmentContainer as NewPaymentRoute } from "./Routes/NewPayment" +import { CounterFragmentContainer as CounterRoute } from "./Routes/Counter" +import { ReviewFragmentContainer as ReviewRoute } from "./Routes/Review" +import { AcceptFragmentContainer as AcceptRoute } from "./Routes/Accept" +import { RejectFragmentContainer as DeclineRoute } from "./Routes/Reject" +import { StatusFragmentContainer as StatusRoute } from "./Routes/Status" + const OrderApp = loadable(() => import("./OrderApp")) -const RespondRoute = loadable(() => import("./Routes/Respond")) -const OfferRoute = loadable(() => import("./Routes/Offer")) -const ShippingRoute = loadable(() => import("./Routes/Shipping")) -const PaymentRoute = loadable(() => import("./Routes/Payment")) -const NewPaymentRoute = loadable(() => import("./Routes/NewPayment")) -const CounterRoute = loadable(() => import("./Routes/Counter")) -const ReviewRoute = loadable(() => import("./Routes/Review")) -const AcceptRoute = loadable(() => import("./Routes/Accept")) -const DeclineRoute = loadable(() => import("./Routes/Reject")) -const StatusRoute = loadable(() => import("./Routes/Status")) // FIXME: // * `render` functions requires casting @@ -74,10 +75,7 @@ export const routes: RouteConfig[] = [ children: [ { path: "respond", - getComponent: () => RespondRoute, - prepare: () => { - RespondRoute.preload() - }, + Component: RespondRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_RespondQuery($orderID: ID!) { @@ -92,10 +90,7 @@ export const routes: RouteConfig[] = [ }, { path: "offer", - getComponent: () => OfferRoute, - prepare: () => { - OfferRoute.preload() - }, + Component: OfferRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_OfferQuery($orderID: ID!) { @@ -110,10 +105,7 @@ export const routes: RouteConfig[] = [ }, { path: "shipping", - getComponent: () => ShippingRoute, - prepare: () => { - ShippingRoute.preload() - }, + Component: ShippingRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_ShippingQuery($orderID: ID!) { @@ -128,10 +120,7 @@ export const routes: RouteConfig[] = [ }, { path: "payment", - getComponent: () => PaymentRoute, - prepare: () => { - PaymentRoute.preload() - }, + Component: PaymentRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_PaymentQuery($orderID: ID!) { @@ -149,10 +138,7 @@ export const routes: RouteConfig[] = [ }, { path: "payment/new", - getComponent: () => NewPaymentRoute, - prepare: () => { - NewPaymentRoute.preload() - }, + Component: NewPaymentRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_NewPaymentQuery($orderID: ID!) { @@ -170,10 +156,7 @@ export const routes: RouteConfig[] = [ }, { path: "review/counter", - getComponent: () => CounterRoute, - prepare: () => { - CounterRoute.preload() - }, + Component: CounterRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_CounterQuery($orderID: ID!) { @@ -188,10 +171,7 @@ export const routes: RouteConfig[] = [ }, { path: "review", - getComponent: () => ReviewRoute, - prepare: () => { - ReviewRoute.preload() - }, + Component: ReviewRoute, shouldWarnBeforeLeaving: true, query: graphql` query routes_ReviewQuery($orderID: ID!) { @@ -206,10 +186,7 @@ export const routes: RouteConfig[] = [ }, { path: "review/accept", - getComponent: () => AcceptRoute, - prepare: () => { - AcceptRoute.preload() - }, + Component: AcceptRoute, query: graphql` query routes_AcceptQuery($orderID: ID!) { order: commerceOrder(id: $orderID) { @@ -223,10 +200,7 @@ export const routes: RouteConfig[] = [ }, { path: "review/decline", - getComponent: () => DeclineRoute, - prepare: () => { - DeclineRoute.preload() - }, + Component: DeclineRoute, query: graphql` query routes_RejectQuery($orderID: ID!) { order: commerceOrder(id: $orderID) { @@ -237,10 +211,7 @@ export const routes: RouteConfig[] = [ }, { path: "status", - getComponent: () => StatusRoute, - prepare: () => { - StatusRoute.preload() - }, + Component: StatusRoute, query: graphql` query routes_StatusQuery($orderID: ID!) { order: commerceOrder(id: $orderID) { @@ -259,7 +230,7 @@ export const routes: RouteConfig[] = [ }) as any, { path: "*", - Component: props => { + Component: (props) => { return }, }, diff --git a/src/v2/Apps/Purchase/Components/PurchaseHistory.tsx b/src/v2/Apps/Purchase/Components/PurchaseHistory.tsx index 8c953b14dd1..f755c2e733b 100644 --- a/src/v2/Apps/Purchase/Components/PurchaseHistory.tsx +++ b/src/v2/Apps/Purchase/Components/PurchaseHistory.tsx @@ -12,7 +12,7 @@ import { } from "@artsy/palette" import { PurchaseHistory_me } from "v2/__generated__/PurchaseHistory_me.graphql" import React, { useState } from "react" -import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay" +import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay" import { get } from "v2/Utils/get" interface OrderRowProps { @@ -128,8 +128,8 @@ const PurchaseHistory: React.FC = ( {myOrders.length ? ( myOrders.map(order => ) ) : ( - No Orders - )} + No Orders + )} = ( /> ) : ( - - ) + + ) } export const PurchaseHistoryFragmentContainer = createRefetchContainer( diff --git a/src/v2/Apps/Purchase/PurchaseApp.tsx b/src/v2/Apps/Purchase/PurchaseApp.tsx index c44959c2cc1..8545924299f 100644 --- a/src/v2/Apps/Purchase/PurchaseApp.tsx +++ b/src/v2/Apps/Purchase/PurchaseApp.tsx @@ -7,6 +7,7 @@ import { Title } from "react-head" import { createFragmentContainer, graphql } from "react-relay" import { userIsAdmin } from "v2/Utils/user" import { PurchaseHistoryFragmentContainer as PurchaseHistory } from "./Components/PurchaseHistory" +import { Spacer } from "@artsy/palette" export interface PurchaseAppProps { me: PurchaseApp_me @@ -20,6 +21,7 @@ export const PurchaseApp = (props: any) => { return ( My Orders | Artsy + ) @@ -29,13 +31,12 @@ export const PurchaseApp = (props: any) => { } } -export const PurchaseAppFragmentContainer = createFragmentContainer( - PurchaseApp, - { - me: graphql` - fragment PurchaseApp_me on Me { - ...PurchaseHistory_me - } - `, - } -) +const PurchaseAppFragmentContainer = createFragmentContainer(PurchaseApp, { + me: graphql` + fragment PurchaseApp_me on Me { + ...PurchaseHistory_me + } + `, +}) + +export default PurchaseAppFragmentContainer diff --git a/src/v2/Apps/Purchase/__tests__/PurchaseApp.jest.tsx b/src/v2/Apps/Purchase/__tests__/PurchaseApp.jest.tsx index 0f5d7c7b5f0..730fec26a69 100644 --- a/src/v2/Apps/Purchase/__tests__/PurchaseApp.jest.tsx +++ b/src/v2/Apps/Purchase/__tests__/PurchaseApp.jest.tsx @@ -9,7 +9,7 @@ import React from "react" import { HeadProvider } from "react-head" import { graphql } from "react-relay" import { PurchaseHistoryProps } from "../Components/PurchaseHistory" -import { PurchaseAppFragmentContainer } from "../PurchaseApp" +import PurchaseAppFragmentContainer from "../PurchaseApp" jest.unmock("react-relay") @@ -72,7 +72,7 @@ const render = (me: PurchaseAppTestQueryRawResponse["me"], user: User) => } } `, - wrapper: children => ( + wrapper: (children) => ( {children} @@ -126,10 +126,7 @@ describe("Purchase app", () => { const pagination = component.find("LargePagination") expect(pagination.length).toBe(1) expect(pagination.text()).toContain("1234...7") - pagination - .find("button") - .at(1) - .simulate("click") + pagination.find("button").at(1).simulate("click") expect(refetchSpy).toHaveBeenCalledTimes(1) expect(refetchSpy.mock.calls[0][0]).toEqual( expect.objectContaining({ first: 10, after: "NQ" }) diff --git a/src/v2/Apps/Purchase/routes.tsx b/src/v2/Apps/Purchase/routes.tsx index e61e828018f..b568de3130f 100644 --- a/src/v2/Apps/Purchase/routes.tsx +++ b/src/v2/Apps/Purchase/routes.tsx @@ -1,13 +1,16 @@ +import loadable from "@loadable/component" import { graphql } from "react-relay" - -// @ts-ignore import { RouteConfig } from "found" -import { PurchaseAppFragmentContainer as PurchaseApp } from "./PurchaseApp" + +const PurchasesApp = loadable(() => import("./PurchaseApp")) export const routes: RouteConfig[] = [ { path: "/user/purchases", - Component: PurchaseApp, + getComponent: () => PurchasesApp, + prepare: () => { + PurchasesApp.preload() + }, query: graphql` query routes_PurchaseQuery { me { diff --git a/src/v2/Apps/Search/Components/GenericSearchResultItem.tsx b/src/v2/Apps/Search/Components/GenericSearchResultItem.tsx index 7930e15fe43..dba8f1e48c4 100644 --- a/src/v2/Apps/Search/Components/GenericSearchResultItem.tsx +++ b/src/v2/Apps/Search/Components/GenericSearchResultItem.tsx @@ -1,12 +1,12 @@ import { Box, - color, Flex, Image, Link, Sans, Serif, Spacer, + color, } from "@artsy/palette" import { track } from "v2/Artsy/Analytics" import * as Schema from "v2/Artsy/Analytics/Schema" @@ -28,7 +28,7 @@ interface GenericSearchResultItemProps { @track() export class GenericSearchResultItem extends React.Component< -GenericSearchResultItemProps + GenericSearchResultItemProps > { @track((props: GenericSearchResultItemProps) => ({ action_type: Schema.ActionType.SelectedItemFromSearchPage, @@ -74,8 +74,8 @@ GenericSearchResultItemProps {imageUrl && entityType !== "City" ? ( ) : ( - - )} + + )} diff --git a/src/v2/Apps/Search/Components/SearchResultsSkeleton/FilterSidebar.tsx b/src/v2/Apps/Search/Components/SearchResultsSkeleton/FilterSidebar.tsx index c457dc737a4..b4b62d68727 100644 --- a/src/v2/Apps/Search/Components/SearchResultsSkeleton/FilterSidebar.tsx +++ b/src/v2/Apps/Search/Components/SearchResultsSkeleton/FilterSidebar.tsx @@ -1,4 +1,4 @@ -import { Box, color, Flex, Separator } from "@artsy/palette" +import { Box, Flex, Separator, color } from "@artsy/palette" import React from "react" const FilterSidebarSection: React.SFC = props => { diff --git a/src/v2/Apps/Search/Components/SearchResultsSkeleton/GridItem.tsx b/src/v2/Apps/Search/Components/SearchResultsSkeleton/GridItem.tsx index 23e25ddaeb4..97d3eecab70 100644 --- a/src/v2/Apps/Search/Components/SearchResultsSkeleton/GridItem.tsx +++ b/src/v2/Apps/Search/Components/SearchResultsSkeleton/GridItem.tsx @@ -1,4 +1,4 @@ -import { Box, BoxProps, color, Spacer } from "@artsy/palette" +import { Box, BoxProps, Spacer, color } from "@artsy/palette" import React from "react" import styled, { css, keyframes } from "styled-components" import { BorderRadiusProps } from "styled-system" diff --git a/src/v2/Apps/Search/Components/SearchResultsSkeleton/Header.tsx b/src/v2/Apps/Search/Components/SearchResultsSkeleton/Header.tsx index 3961baf42ba..b141deea802 100644 --- a/src/v2/Apps/Search/Components/SearchResultsSkeleton/Header.tsx +++ b/src/v2/Apps/Search/Components/SearchResultsSkeleton/Header.tsx @@ -1,4 +1,4 @@ -import { Box, color, Separator } from "@artsy/palette" +import { Box, Separator, color } from "@artsy/palette" import React from "react" export const Header: React.SFC = () => { diff --git a/src/v2/Apps/Search/Components/SendFeedback.tsx b/src/v2/Apps/Search/Components/SendFeedback.tsx index 691483813a7..fe1fc3c15b6 100644 --- a/src/v2/Apps/Search/Components/SendFeedback.tsx +++ b/src/v2/Apps/Search/Components/SendFeedback.tsx @@ -2,11 +2,11 @@ import { Box, Button, CheckCircleIcon, - color, Flex, Input, Serif, TextArea, + color, } from "@artsy/palette" import { SendFeedbackSearchResultsMutation } from "v2/__generated__/SendFeedbackSearchResultsMutation.graphql" import { SystemContextProps } from "v2/Artsy" diff --git a/src/v2/Apps/Search/Components/__tests__/SendFeedback.jest.tsx b/src/v2/Apps/Search/Components/__tests__/SendFeedback.jest.tsx index 9aab5953eb1..4838f89fe28 100644 --- a/src/v2/Apps/Search/Components/__tests__/SendFeedback.jest.tsx +++ b/src/v2/Apps/Search/Components/__tests__/SendFeedback.jest.tsx @@ -1,7 +1,7 @@ import { Button } from "@artsy/palette" import { SendFeedback } from "v2/Apps/Search/Components/SendFeedback" import { MockBoot } from "v2/DevTools" -import { mount, ReactWrapper } from "enzyme" +import { ReactWrapper, mount } from "enzyme" import React from "react" import { commitMutation as _commitMutation } from "react-relay" import { Environment } from "relay-runtime" diff --git a/src/v2/Apps/Search/Routes/Artists/SearchResultsArtists.tsx b/src/v2/Apps/Search/Routes/Artists/SearchResultsArtists.tsx index 033d82705d3..baeef4aa00a 100644 --- a/src/v2/Apps/Search/Routes/Artists/SearchResultsArtists.tsx +++ b/src/v2/Apps/Search/Routes/Artists/SearchResultsArtists.tsx @@ -7,7 +7,7 @@ import { PaginationFragmentContainer as Pagination } from "v2/Components/Paginat import { RouterState, withRouter } from "found" import qs from "qs" import React from "react" -import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay" +import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay" import { get } from "v2/Utils/get" export interface Props extends RouterState { @@ -153,8 +153,8 @@ export class SearchResultsArtistsRoute extends React.Component { ) : ( - this.renderArtists() - )} + this.renderArtists() + )} ) } diff --git a/src/v2/Apps/Search/Routes/Entity/SearchResultsEntity.tsx b/src/v2/Apps/Search/Routes/Entity/SearchResultsEntity.tsx index 0533f5387f0..a592820e5bf 100644 --- a/src/v2/Apps/Search/Routes/Entity/SearchResultsEntity.tsx +++ b/src/v2/Apps/Search/Routes/Entity/SearchResultsEntity.tsx @@ -7,7 +7,7 @@ import { PaginationFragmentContainer as Pagination } from "v2/Components/Paginat import { RouterState, withRouter } from "found" import qs from "qs" import React from "react" -import { createRefetchContainer, graphql, RelayRefetchProp } from "react-relay" +import { RelayRefetchProp, createRefetchContainer, graphql } from "react-relay" import { get } from "v2/Utils/get" export interface Props extends RouterState { @@ -156,8 +156,8 @@ export class SearchResultsEntityRoute extends React.Component { ) : ( - this.renderItems() - )} + this.renderItems() + )} ) } diff --git a/src/v2/Apps/Search/SearchApp.tsx b/src/v2/Apps/Search/SearchApp.tsx index e5903f22305..a3feefcd17f 100644 --- a/src/v2/Apps/Search/SearchApp.tsx +++ b/src/v2/Apps/Search/SearchApp.tsx @@ -12,7 +12,7 @@ import { Footer } from "v2/Components/Footer" import { RecentlyViewedQueryRenderer as RecentlyViewed } from "v2/Components/RecentlyViewed" import { RouterState, withRouter } from "found" -import React, { useEffect, useState } from "react" +import React, { useCallback, useEffect, useState } from "react" import { createFragmentContainer, graphql } from "react-relay" import { TrackingProp } from "react-tracking" import { get } from "v2/Utils/get" @@ -27,13 +27,17 @@ const TotalResults: React.SFC<{ count: number; term: string }> = ({ count, term, }) => { - const formatResults = () => - `${count.toLocaleString()} Result${count > 1 ? "s" : ""} for "${term}"` + const formatResults = useCallback( + () => + `${count.toLocaleString()} Result${count > 1 ? "s" : ""} for "${term}"`, + [count, term] + ) + const [results, setResults] = useState(formatResults()) useEffect(() => { setResults(formatResults()) - }, [count]) + }, [count, formatResults]) return {results} } @@ -129,11 +133,11 @@ export class SearchApp extends React.Component { artworkCount ) ) : ( - - - {this.renderFooter()} - - )} + + + {this.renderFooter()} + + )} diff --git a/src/v2/Apps/WorksForYou/WorksForYouArtistFeed.tsx b/src/v2/Apps/WorksForYou/WorksForYouArtistFeed.tsx index 1573c722559..a10f05f5f39 100644 --- a/src/v2/Apps/WorksForYou/WorksForYouArtistFeed.tsx +++ b/src/v2/Apps/WorksForYou/WorksForYouArtistFeed.tsx @@ -7,9 +7,9 @@ import styled from "styled-components" import { get } from "v2/Utils/get" import { + RelayPaginationProp, createPaginationContainer, graphql, - RelayPaginationProp, } from "react-relay" interface Props extends SystemContextProps { diff --git a/src/v2/Apps/WorksForYou/WorksForYouFeed.tsx b/src/v2/Apps/WorksForYou/WorksForYouFeed.tsx index a9485914c2f..54fe1f047b8 100644 --- a/src/v2/Apps/WorksForYou/WorksForYouFeed.tsx +++ b/src/v2/Apps/WorksForYou/WorksForYouFeed.tsx @@ -8,9 +8,9 @@ import styled from "styled-components" import { get } from "v2/Utils/get" import { + RelayPaginationProp, createPaginationContainer, graphql, - RelayPaginationProp, } from "react-relay" interface Props extends SystemContextProps { diff --git a/src/v2/Apps/__stories__/OrderApp.story.tsx b/src/v2/Apps/__stories__/OrderApp.story.tsx index 4887d87a735..135b5f6e3c3 100644 --- a/src/v2/Apps/__stories__/OrderApp.story.tsx +++ b/src/v2/Apps/__stories__/OrderApp.story.tsx @@ -1,12 +1,12 @@ import { - Buyer, BuyOrderPickup, BuyOrderWithShippingDetails, + Buyer, OfferOrderPickup, OfferOrderWithOffers, OfferOrderWithShippingDetails, - Offers, OfferWithTotals, + Offers, PaymentDetails, ShippingTotals, TaxTotals, diff --git a/src/v2/Apps/getAppRoutes.tsx b/src/v2/Apps/getAppRoutes.tsx index 8ad532cba2c..814776bdc58 100644 --- a/src/v2/Apps/getAppRoutes.tsx +++ b/src/v2/Apps/getAppRoutes.tsx @@ -4,8 +4,10 @@ import { routes as artistRoutes } from "v2/Apps/Artist/routes" import { routes as artworkRoutes } from "v2/Apps/Artwork/routes" import { collectRoutes } from "v2/Apps/Collect/collectRoutes" import { conversationRoutes } from "v2/Apps/Conversation/routes" +import { routes as featureRoutes } from "v2/Apps/Feature/routes" import { routes as identityVerificationRoutes } from "v2/Apps/IdentityVerification/routes" import { routes as orderRoutes } from "v2/Apps/Order/routes" +import { routes as purchasesRoutes } from "v2/Apps/Purchase/routes" import { routes as searchRoutes } from "v2/Apps/Search/routes" import { routes as viewingRoomRoutes } from "./ViewingRoom/routes" @@ -23,12 +25,18 @@ export function getAppRoutes(): RouteConfig[] { { routes: conversationRoutes, }, + { + routes: featureRoutes, + }, { routes: identityVerificationRoutes, }, { routes: orderRoutes, }, + { + routes: purchasesRoutes, + }, { routes: searchRoutes, }, diff --git a/src/v2/Artsy/Analytics/trackingMiddleware.ts b/src/v2/Artsy/Analytics/trackingMiddleware.ts index a3d6ebb3dfd..8468d592040 100644 --- a/src/v2/Artsy/Analytics/trackingMiddleware.ts +++ b/src/v2/Artsy/Analytics/trackingMiddleware.ts @@ -17,7 +17,7 @@ interface TrackingMiddlewareOptions { } export function trackingMiddleware(options: TrackingMiddlewareOptions = {}) { - return store => next => action => { + return (store) => (next) => (action) => { const { excludePaths = [] } = options const { type, payload } = action @@ -26,7 +26,7 @@ export function trackingMiddleware(options: TrackingMiddlewareOptions = {}) { const { pathname } = payload const referrer = get( store.getState(), - state => + (state) => state.found.match.location.pathname + state.found.match.location.search ) @@ -39,7 +39,7 @@ export function trackingMiddleware(options: TrackingMiddlewareOptions = {}) { // TODO: Pass referrer over to Artwork page if A/B test passes // window.sd.routerReferrer = referrer - const foundExcludedPath = excludePaths.some(excludedPath => { + const foundExcludedPath = excludePaths.some((excludedPath) => { const matcher = match(excludedPath, { decode: decodeURIComponent }) const foundMatch = !!matcher(pathname) return foundMatch @@ -60,16 +60,6 @@ export function trackingMiddleware(options: TrackingMiddlewareOptions = {}) { trackingData.referrer = sd.APP_URL + referrer } - // TODO: Remove after EXPERIMENTAL_APP_SHELL AB test ends. - if ( - ["/collect", "/collections", "/collection/"].some(path => - pathname.includes(path) - ) && - referrer - ) { - trackingData.referrer = sd.APP_URL + referrer - } - /** * Store a global reference to the referrer. Since we're in an SPA * context we'll need to use this to track referrers statefully across @@ -90,11 +80,6 @@ export function trackingMiddleware(options: TrackingMiddlewareOptions = {}) { Marketo: false, }, }) - - // TODO: Remove after EXPERIMENTAL_APP_SHELL AB test ends. - // if (sd.CLIENT_NAVIGATION_V5) { - // trackExperimentViewed("client_navigation_v5", trackingData) - // } } // Reset timers that track time on page since we're tracking each order @@ -104,7 +89,7 @@ export function trackingMiddleware(options: TrackingMiddlewareOptions = {}) { window.desktopPageTimeTrackers if (desktopPageTimeTrackers) { - desktopPageTimeTrackers.forEach(tracker => { + desktopPageTimeTrackers.forEach((tracker) => { // No need to reset the tracker if we're on the same page. if (pathname !== tracker.path) { tracker.reset(pathname) diff --git a/src/v2/Artsy/Analytics/useRouteTracking.tsx b/src/v2/Artsy/Analytics/useRouteTracking.tsx index 34c41bcffec..6b29552be24 100644 --- a/src/v2/Artsy/Analytics/useRouteTracking.tsx +++ b/src/v2/Artsy/Analytics/useRouteTracking.tsx @@ -21,7 +21,7 @@ export function useRouteTracking() { setShouldTrack(false) }) } - }, [isFetching]) + }, [isFetching, prevFetching]) return shouldTrack } diff --git a/src/v2/Artsy/Relay/createRelaySSREnvironment.ts b/src/v2/Artsy/Relay/createRelaySSREnvironment.ts index 926cdaf360e..6d8d2e4d823 100644 --- a/src/v2/Artsy/Relay/createRelaySSREnvironment.ts +++ b/src/v2/Artsy/Relay/createRelaySSREnvironment.ts @@ -8,10 +8,10 @@ import { Environment, INetwork, RecordSource, Store } from "relay-runtime" import { data as sd } from "sharify" import { + RelayNetworkLayer, cacheMiddleware, errorMiddleware, loggerMiddleware, - RelayNetworkLayer, urlMiddleware, } from "react-relay-network-modern/node8" import { metaphysicsErrorHandlerMiddleware } from "./middleware/metaphysicsErrorHandlerMiddleware" diff --git a/src/v2/Artsy/Relay/renderWithLoadProgress.tsx b/src/v2/Artsy/Relay/renderWithLoadProgress.tsx index b42b1deb113..ac849d51643 100644 --- a/src/v2/Artsy/Relay/renderWithLoadProgress.tsx +++ b/src/v2/Artsy/Relay/renderWithLoadProgress.tsx @@ -1,8 +1,8 @@ import { Spinner, SpinnerProps } from "@artsy/palette" import React from "react" import { - Container as RelayContainer, QueryRendererReadyState, + Container as RelayContainer, } from "react-relay" import styled from "styled-components" import createLogger from "v2/Utils/logger" diff --git a/src/v2/Artsy/Router/Boot.tsx b/src/v2/Artsy/Router/Boot.tsx index ed7e972c6fc..5ca357d4ec8 100644 --- a/src/v2/Artsy/Router/Boot.tsx +++ b/src/v2/Artsy/Router/Boot.tsx @@ -1,4 +1,4 @@ -import { Grid, injectGlobalStyles, Theme, themeProps } from "@artsy/palette" +import { Grid, Theme, injectGlobalStyles, themeProps } from "@artsy/palette" import * as Sentry from "@sentry/browser" import { SystemContextProvider, track } from "v2/Artsy" import { RouteConfig } from "found" diff --git a/src/v2/Artsy/Router/NetworkOfflineMonitor.tsx b/src/v2/Artsy/Router/NetworkOfflineMonitor.tsx index 1cbd273708f..5d2b686baf1 100644 --- a/src/v2/Artsy/Router/NetworkOfflineMonitor.tsx +++ b/src/v2/Artsy/Router/NetworkOfflineMonitor.tsx @@ -15,7 +15,7 @@ export const NetworkOfflineMonitor: React.FC = () => { window.removeEventListener("offline", setOffline) window.removeEventListener("online", setOnline) } - }, []) + }, [setOffline, setOnline]) if (!showOfflineModal) { return null diff --git a/src/v2/Artsy/Router/NetworkTimeout.tsx b/src/v2/Artsy/Router/NetworkTimeout.tsx index c3dcf7ed91b..f11b948b22f 100644 --- a/src/v2/Artsy/Router/NetworkTimeout.tsx +++ b/src/v2/Artsy/Router/NetworkTimeout.tsx @@ -25,7 +25,7 @@ export const NetworkTimeout: React.FC = () => { return () => { clearTimeout(timeout) } - }, []) + }, [showErrorModal]) if (!showErrorModal) { return null diff --git a/src/v2/Artsy/Router/RenderStatus.tsx b/src/v2/Artsy/Router/RenderStatus.tsx index 551ac526a2b..ae1743de93f 100644 --- a/src/v2/Artsy/Router/RenderStatus.tsx +++ b/src/v2/Artsy/Router/RenderStatus.tsx @@ -13,7 +13,7 @@ import { PageLoader } from "./PageLoader" const logger = createLogger("Artsy/Router/Utils/RenderStatus") export const RenderPending = () => { - const { isFetching, setFetching, EXPERIMENTAL_APP_SHELL } = useSystemContext() + const { isFetching, setFetching } = useSystemContext() /** * First, set fetching to ensure that components that are listening for this @@ -26,43 +26,25 @@ export const RenderPending = () => { } if (isFetching) { - if (EXPERIMENTAL_APP_SHELL) { - return ( - <> - {null} - - - - - - ) - } else { - return ( - <> - {null} - - - ) - } + return ( + <> + {null} + + + + + + ) } } diff --git a/src/v2/Artsy/Router/Utils/__tests__/findCurrentRoute.jest.ts b/src/v2/Artsy/Router/Utils/__tests__/findCurrentRoute.jest.ts index e3b7baaffa0..4de6b7df8b5 100644 --- a/src/v2/Artsy/Router/Utils/__tests__/findCurrentRoute.jest.ts +++ b/src/v2/Artsy/Router/Utils/__tests__/findCurrentRoute.jest.ts @@ -1,5 +1,5 @@ import { findCurrentRoute } from "../findCurrentRoute" -import { Match, Router, Location } from "found" +import { Location, Match, Router } from "found" describe("findCurrentRoute", () => { const getMatch = (config: Partial): Match => ({ diff --git a/src/v2/Artsy/Router/Utils/matchingMediaQueriesForUserAgent.ts b/src/v2/Artsy/Router/Utils/matchingMediaQueriesForUserAgent.ts index 1228f8729f8..77ef6b4111a 100644 --- a/src/v2/Artsy/Router/Utils/matchingMediaQueriesForUserAgent.ts +++ b/src/v2/Artsy/Router/Utils/matchingMediaQueriesForUserAgent.ts @@ -1,8 +1,8 @@ import { findDevice } from "@artsy/detect-responsive-traits" import { + MatchingMediaQueries, findBreakpointAtWidth, findBreakpointsForWidths, - MatchingMediaQueries, } from "v2/Utils/Responsive" /** @@ -24,14 +24,14 @@ export function matchingMediaQueriesForUserAgent( const supportsHover = device.touch ? "notHover" : "hover" const onlyMatch: MatchingMediaQueries = device.resizable ? [ - supportsHover, - ...findBreakpointsForWidths(device.minWidth, device.maxWidth), - ] + supportsHover, + ...findBreakpointsForWidths(device.minWidth, device.maxWidth), + ] : [ - supportsHover, - findBreakpointAtWidth(device.minWidth), - findBreakpointAtWidth(device.maxWidth), - ] + supportsHover, + findBreakpointAtWidth(device.minWidth), + findBreakpointAtWidth(device.maxWidth), + ] return onlyMatch } } diff --git a/src/v2/Artsy/Router/Utils/useMaybeReloadAfterInquirySignIn.tsx b/src/v2/Artsy/Router/Utils/useMaybeReloadAfterInquirySignIn.tsx index 567cb841917..8d6e6b70659 100644 --- a/src/v2/Artsy/Router/Utils/useMaybeReloadAfterInquirySignIn.tsx +++ b/src/v2/Artsy/Router/Utils/useMaybeReloadAfterInquirySignIn.tsx @@ -21,5 +21,5 @@ export function useMaybeReloadAfterInquirySignIn() { mediator.off("auth:login:inquiry_form") mediator.off("auth:login:inquiry_form:maybeReloadOnModalClose") } - }, []) + }, [mediator]) } diff --git a/src/v2/Artsy/Router/__tests__/buildServerApp.jest.tsx b/src/v2/Artsy/Router/__tests__/buildServerApp.jest.tsx index 183e0b1d386..aa303e0d61c 100644 --- a/src/v2/Artsy/Router/__tests__/buildServerApp.jest.tsx +++ b/src/v2/Artsy/Router/__tests__/buildServerApp.jest.tsx @@ -5,9 +5,9 @@ import { SystemContextConsumer } from "v2/Artsy" import { createRelaySSREnvironment } from "v2/Artsy/Relay/createRelaySSREnvironment" import { + ServerRouterConfig, __THOU_SHALT_NOT_FAFF_AROUND_WITH_THIS_HERE_OBJECT_WE_ARE_SERIOUS__, buildServerApp, - ServerRouterConfig, } from "v2/Artsy/Router/buildServerApp" import { createMockNetworkLayer } from "v2/DevTools" import { render } from "enzyme" diff --git a/src/v2/Artsy/Router/buildAppRoutes.tsx b/src/v2/Artsy/Router/buildAppRoutes.tsx index b4245673805..9b474f8ef72 100644 --- a/src/v2/Artsy/Router/buildAppRoutes.tsx +++ b/src/v2/Artsy/Router/buildAppRoutes.tsx @@ -35,7 +35,7 @@ export function buildAppRoutes(routeList: RouteList[]): RouteConfig[] { router: props.router, routes, }) - }, []) + }, [props.router, router, setRouter]) return } diff --git a/src/v2/Artsy/Router/buildClientApp.tsx b/src/v2/Artsy/Router/buildClientApp.tsx index 99dc6889c40..966106c27a7 100644 --- a/src/v2/Artsy/Router/buildClientApp.tsx +++ b/src/v2/Artsy/Router/buildClientApp.tsx @@ -68,11 +68,7 @@ export function buildClientApp(config: RouterConfig): Promise { stringify: qs.stringify, }), trackingMiddleware({ - excludePaths: [ - "/artwork(.*)", - // FIXME: Remove once old feature pages are migrated - "/feature(.*)", - ], + excludePaths: ["/artwork(.*)"], }), ] const resolver = new Resolver(relayEnvironment) diff --git a/src/v2/Artsy/Router/useRouter.tsx b/src/v2/Artsy/Router/useRouter.tsx index 86bd017712e..029dc32c18e 100644 --- a/src/v2/Artsy/Router/useRouter.tsx +++ b/src/v2/Artsy/Router/useRouter.tsx @@ -2,7 +2,7 @@ import { useContext } from "react" // FIXME: Upgrade to Found 5.0: https://github.com/4Catalyzer/found/releases/tag/v0.5.0 // @ts-ignore -import { RouterContext, Router, Match } from "found" +import { Match, Router, RouterContext } from "found" export function useRouter(): { match: Match diff --git a/src/v2/Artsy/SystemContext.tsx b/src/v2/Artsy/SystemContext.tsx index 14f7ddd3085..63fb0ccfffe 100644 --- a/src/v2/Artsy/SystemContext.tsx +++ b/src/v2/Artsy/SystemContext.tsx @@ -76,9 +76,6 @@ export interface SystemContextProps extends SystemContextState { * Useful for passing arbitrary data from Force. */ injectedData?: any - - // TODO: Remove once A/B test completes - EXPERIMENTAL_APP_SHELL?: boolean } export const SystemContext = React.createContext({}) diff --git a/src/v2/Components/ArtistCard.tsx b/src/v2/Components/ArtistCard.tsx index 93326e4443f..de7db0c694b 100644 --- a/src/v2/Components/ArtistCard.tsx +++ b/src/v2/Components/ArtistCard.tsx @@ -18,8 +18,8 @@ import { Link, Sans, Serif, - space, Spacer, + space, } from "@artsy/palette" import styled from "styled-components" diff --git a/src/v2/Components/Artwork/Details.tsx b/src/v2/Components/Artwork/Details.tsx index 6a190df1e04..ac0f2bd4ebb 100644 --- a/src/v2/Components/Artwork/Details.tsx +++ b/src/v2/Components/Artwork/Details.tsx @@ -1,4 +1,4 @@ -import { color, Sans, Spacer } from "@artsy/palette" +import { Sans, Spacer, color } from "@artsy/palette" import { Details_artwork } from "v2/__generated__/Details_artwork.graphql" import { SystemContextConsumer } from "v2/Artsy" import React from "react" @@ -66,8 +66,8 @@ export class Details extends React.Component { const artworkTextWithLink = includeLinks ? ( {artworkText} ) : ( - artworkText - ) + artworkText + ) return {artworkTextWithLink} } diff --git a/src/v2/Components/Artwork/GridItem.tsx b/src/v2/Components/Artwork/GridItem.tsx index 10f3d2daae9..6d1d346a4bb 100644 --- a/src/v2/Components/Artwork/GridItem.tsx +++ b/src/v2/Components/Artwork/GridItem.tsx @@ -1,5 +1,5 @@ import { AuthContextModule, ContextModule } from "@artsy/cohesion" -import { color, Image as BaseImage } from "@artsy/palette" +import { Image as BaseImage, color } from "@artsy/palette" import { GridItem_artwork } from "v2/__generated__/GridItem_artwork.graphql" import { Mediator } from "v2/Artsy" import { withSystemContext } from "v2/Artsy" diff --git a/src/v2/Components/Artwork/Save.tsx b/src/v2/Components/Artwork/Save.tsx index 87f320ce3ba..cab2d3d6943 100644 --- a/src/v2/Components/Artwork/Save.tsx +++ b/src/v2/Components/Artwork/Save.tsx @@ -6,10 +6,10 @@ import { track } from "v2/Artsy/Analytics" import { extend, isNull } from "lodash" import React from "react" import { + RelayProp, commitMutation, createFragmentContainer, graphql, - RelayProp, } from "react-relay" import { TrackingProp } from "react-tracking" import * as RelayRuntimeTypes from "relay-runtime" @@ -26,7 +26,7 @@ export interface SaveTrackingProps { export interface SaveProps extends Artsy.SystemContextProps, - React.HTMLProps { + React.HTMLProps { artwork: Save_artwork contextModule: AuthContextModule style?: any diff --git a/src/v2/Components/Auction/AuctionRegistrationModal.tsx b/src/v2/Components/Auction/AuctionRegistrationModal.tsx index 458d11f10b0..761d644150e 100644 --- a/src/v2/Components/Auction/AuctionRegistrationModal.tsx +++ b/src/v2/Components/Auction/AuctionRegistrationModal.tsx @@ -51,7 +51,7 @@ export const AuctionRegistrationModal: React.FC = ({ if (!show) { onClose() } - }, [show]) + }, [show, onClose]) function validate() { if (acceptedConditions) { @@ -91,11 +91,11 @@ export const AuctionRegistrationModal: React.FC = ({ ) : ( - - Welcome back. To complete your registration, please confirm that you - agree to the Conditions of Sale. - - )} + + Welcome back. To complete your registration, please confirm that you + agree to the Conditions of Sale. + + )} diff --git a/src/v2/Components/Auction/PostRegistrationModal.tsx b/src/v2/Components/Auction/PostRegistrationModal.tsx index 895445aa4f0..34e532c51b3 100644 --- a/src/v2/Components/Auction/PostRegistrationModal.tsx +++ b/src/v2/Components/Auction/PostRegistrationModal.tsx @@ -97,7 +97,7 @@ export const PostRegistrationModal: React.FC = ({ if (!show) { onClose() } - }, [show]) + }, [show, onClose]) const Content = contentFor[contentKey] diff --git a/src/v2/Components/Authentication/FormSwitcher.tsx b/src/v2/Components/Authentication/FormSwitcher.tsx index d43e0f33b18..be2b2d83761 100644 --- a/src/v2/Components/Authentication/FormSwitcher.tsx +++ b/src/v2/Components/Authentication/FormSwitcher.tsx @@ -1,4 +1,4 @@ -import { authImpression, AuthModalType } from "@artsy/cohesion" +import { AuthModalType, authImpression } from "@artsy/cohesion" import { Theme } from "@artsy/palette" import qs from "querystring" import React from "react" @@ -87,8 +87,8 @@ export class FormSwitcher extends React.Component { }, type === "signup" ? { - onboarding: !redirectTo, - } + onboarding: !redirectTo, + } : null ) @@ -166,13 +166,13 @@ export class FormSwitcher extends React.Component { }, options.redirectTo || options["redirect-to"] ? { - "redirect-to": options.redirectTo || options["redirect-to"], - } + "redirect-to": options.redirectTo || options["redirect-to"], + } : null, options.intent ? { - "signup-intent": options.intent, - } + "signup-intent": options.intent, + } : null ) diff --git a/src/v2/Components/Authentication/Mobile/LoginForm.tsx b/src/v2/Components/Authentication/Mobile/LoginForm.tsx index afae5bfcbf8..54ee0d52298 100644 --- a/src/v2/Components/Authentication/Mobile/LoginForm.tsx +++ b/src/v2/Components/Authentication/Mobile/LoginForm.tsx @@ -73,7 +73,7 @@ const OtpInputTrigger: React.FC = props => { props.next(null, values) }) } - }, [status]) + }, [status, isOtpMissing, props, values]) return null } @@ -86,7 +86,7 @@ interface LoginFormState { class MobileLoginFormWithSystemContext extends Component< FormProps & { relayEnvironment: Environment }, LoginFormState - > { +> { constructor(props) { super(props) @@ -149,25 +149,25 @@ class MobileLoginFormWithSystemContext extends Component< wizard, form: { errors, touched, values, handleChange, handleBlur, setTouched }, }) => ( - - - - this.getForgotUrl()} /> - - - )} + + + + this.getForgotUrl()} /> + + + )} , ] @@ -208,7 +208,7 @@ class MobileLoginFormWithSystemContext extends Component< this.props.onBackButtonClicked && - wizard.currentStepIndex === 0 + wizard.currentStepIndex === 0 ? this.props.onBackButtonClicked(e as any) : wizard.previous(e, values) } diff --git a/src/v2/Components/Authentication/__tests__/Desktop/LoginForm.jest.tsx b/src/v2/Components/Authentication/__tests__/Desktop/LoginForm.jest.tsx index 5ebcf60552d..f7d7c29f2ed 100644 --- a/src/v2/Components/Authentication/__tests__/Desktop/LoginForm.jest.tsx +++ b/src/v2/Components/Authentication/__tests__/Desktop/LoginForm.jest.tsx @@ -1,7 +1,7 @@ import { LoginForm } from "v2/Components/Authentication/Desktop/LoginForm" import { mount } from "enzyme" import React from "react" -import { LoginValues, ChangeEvents } from "../fixtures" +import { ChangeEvents, LoginValues } from "../fixtures" import QuickInput from "v2/Components/QuickInput" import { flushPromiseQueue } from "v2/DevTools" diff --git a/src/v2/Components/Authentication/__tests__/Desktop/ModalManager.jest.tsx b/src/v2/Components/Authentication/__tests__/Desktop/ModalManager.jest.tsx index 9b31f984fd7..7d5f84dd1b2 100644 --- a/src/v2/Components/Authentication/__tests__/Desktop/ModalManager.jest.tsx +++ b/src/v2/Components/Authentication/__tests__/Desktop/ModalManager.jest.tsx @@ -1,9 +1,9 @@ import { LoginForm } from "v2/Components/Authentication/Desktop/LoginForm" import { ModalType } from "v2/Components/Authentication/Types" -import { mount, ReactWrapper } from "enzyme" +import { ReactWrapper, mount } from "enzyme" import React from "react" -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { ModalManager, ModalManagerProps, diff --git a/src/v2/Components/Authentication/__tests__/FormSwitcher.jest.tsx b/src/v2/Components/Authentication/__tests__/FormSwitcher.jest.tsx index a86dc4bc4a9..bebeb29eac0 100644 --- a/src/v2/Components/Authentication/__tests__/FormSwitcher.jest.tsx +++ b/src/v2/Components/Authentication/__tests__/FormSwitcher.jest.tsx @@ -1,4 +1,4 @@ -import { Intent, ContextModule } from "@artsy/cohesion" +import { ContextModule, Intent } from "@artsy/cohesion" import { Link } from "@artsy/palette" import QuickInput from "v2/Components/QuickInput" import { mount } from "enzyme" diff --git a/src/v2/Components/CCPARequest.tsx b/src/v2/Components/CCPARequest.tsx index f7c1d129970..a1fa01fd790 100644 --- a/src/v2/Components/CCPARequest.tsx +++ b/src/v2/Components/CCPARequest.tsx @@ -272,7 +272,15 @@ export const CCPARequest: React.SFC = props => { setSubmitted, }) } - }, [clickedSubmit]) + }, [ + clickedSubmit, + email, + name, + notes, + relayEnvironment, + triggeredValidation, + user, + ]) const modalButton = submitted ? (