diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index cf03e17a..9f7c18fc 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,27 +1,41 @@
-name: Lint Web Embeds
+name: Lint Web Packages
on:
push:
+ branches:
+ - main
paths:
- 'web-embeds/**'
+ - 'packages/web-shared/**'
+ - '.github/workflows/lint.yml'
+ - 'package.json'
+ - 'yarn.lock'
pull_request:
paths:
- 'web-embeds/**'
+ - 'packages/web-shared/**'
+ - '.github/workflows/lint.yml'
+ - 'package.json'
+ - 'yarn.lock'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Set up Node.js
- uses: actions/setup-node@v1
+ uses: actions/setup-node@v4
with:
- node-version: '>=18.17.0'
+ node-version: '18'
+ cache: 'yarn'
- - name: Install Dependencies
- run: cd web-embeds && yarn install
+ - name: Install dependencies
+ run: yarn install --frozen-lockfile
- - name: Run Lint
- run: cd web-embeds && yarn lint
+ - name: Lint web embeds
+ run: yarn workspace @apollosproject/apollos-embeds lint
+
+ - name: Lint web shared
+ run: yarn workspace @apollosproject/web-shared lint
diff --git a/packages/web-shared/.eslintrc.js b/packages/web-shared/.eslintrc.js
new file mode 100644
index 00000000..3692f4ed
--- /dev/null
+++ b/packages/web-shared/.eslintrc.js
@@ -0,0 +1,44 @@
+module.exports = {
+ extends: ['react-app', 'plugin:prettier/recommended'],
+ plugins: ['simple-import-sort', 'import'],
+ rules: {
+ 'import/first': 'error',
+ 'import/newline-after-import': 'error',
+ 'import/no-duplicates': 'error',
+ 'import/order': [
+ 'error',
+ {
+ groups: [['external', 'builtin'], 'internal', ['sibling', 'parent'], 'index'],
+ pathGroups: [
+ {
+ pattern: '@(react|react-native)',
+ group: 'external',
+ position: 'before',
+ },
+ {
+ pattern: '@src/**',
+ group: 'internal',
+ },
+ ],
+ pathGroupsExcludedImportTypes: ['internal', 'react'],
+ 'newlines-between': 'always',
+ alphabetize: {
+ order: 'asc',
+ caseInsensitive: true,
+ },
+ },
+ ],
+ 'lines-around-comment': [
+ 'error',
+ {
+ allowArrayStart: true,
+ allowBlockStart: true,
+ allowClassStart: true,
+ allowObjectStart: true,
+ beforeBlockComment: true,
+ beforeLineComment: true,
+ },
+ ],
+ 'spaced-comment': ['error', 'always'],
+ },
+};
diff --git a/packages/web-shared/analytics/segment.js b/packages/web-shared/analytics/segment.js
index 34cd0135..3d0becd4 100644
--- a/packages/web-shared/analytics/segment.js
+++ b/packages/web-shared/analytics/segment.js
@@ -1,4 +1,5 @@
import { AnalyticsBrowser } from '@segment/analytics-next';
+
const clientFactory = (writeKey, clientManaged = false) => {
if (!writeKey) {
return null;
diff --git a/packages/web-shared/client/apolloClient.js b/packages/web-shared/client/apolloClient.js
index 01c42833..ab11bcd5 100644
--- a/packages/web-shared/client/apolloClient.js
+++ b/packages/web-shared/client/apolloClient.js
@@ -1,11 +1,11 @@
import { ApolloClient, ApolloLink } from '@apollo/client';
-import { AUTH_TOKEN_KEY, AUTH_REFRESH_TOKEN_KEY } from '../config/keys';
import apollosApiLink from './apollosApiLink';
import authLink from './authLink';
+import buildErrorLink from './buildErrorLink';
import httpLink from './httpLink';
import initCache from './initCache';
-import buildErrorLink from './buildErrorLink';
+import { AUTH_TOKEN_KEY, AUTH_REFRESH_TOKEN_KEY } from '../config/keys';
const client = async (church_slug) => {
let storeIsResetting = false;
diff --git a/packages/web-shared/client/authLink.js b/packages/web-shared/client/authLink.js
index dd0794d8..b8262552 100644
--- a/packages/web-shared/client/authLink.js
+++ b/packages/web-shared/client/authLink.js
@@ -1,4 +1,5 @@
import { setContext } from '@apollo/client/link/context';
+
import { AUTH_TOKEN_KEY } from '../config/keys';
export default setContext(async (request, { headers }) => {
diff --git a/packages/web-shared/client/httpLink.js b/packages/web-shared/client/httpLink.js
index 705343a9..e083a92a 100644
--- a/packages/web-shared/client/httpLink.js
+++ b/packages/web-shared/client/httpLink.js
@@ -1,6 +1,6 @@
-import { createUploadLink } from 'apollo-upload-client';
import { split, createHttpLink } from '@apollo/client';
import { getMainDefinition } from '@apollo/client/utilities';
+import { createUploadLink } from 'apollo-upload-client';
export const uri =
process.env.NEXT_PUBLIC_DATA_URL || process.env.REACT_APP_DATA_URL || 'https://cdn.apollos.app';
diff --git a/packages/web-shared/client/initCache.js b/packages/web-shared/client/initCache.js
index 74bccfbe..d80fed76 100644
--- a/packages/web-shared/client/initCache.js
+++ b/packages/web-shared/client/initCache.js
@@ -1,5 +1,6 @@
import { InMemoryCache } from '@apollo/client/core';
import { persistCache } from 'apollo3-cache-persist';
+
import { uri } from './httpLink';
const initCache = async (initialState, { church }) => {
diff --git a/packages/web-shared/client/introspectionToPossibleTypes.js b/packages/web-shared/client/introspectionToPossibleTypes.js
index c7bd03a0..aa77213d 100644
--- a/packages/web-shared/client/introspectionToPossibleTypes.js
+++ b/packages/web-shared/client/introspectionToPossibleTypes.js
@@ -3,9 +3,7 @@ function introspectionToPossibleTypes(introspectionQueryResultData) {
introspectionQueryResultData.__schema.types.forEach((supertype) => {
if (supertype.possibleTypes) {
- possibleTypes[supertype.name] = [
- ...supertype.possibleTypes.map((subtype) => subtype.name),
- ];
+ possibleTypes[supertype.name] = [...supertype.possibleTypes.map((subtype) => subtype.name)];
}
});
diff --git a/packages/web-shared/components/AddToCalendar/AddToCalendar.js b/packages/web-shared/components/AddToCalendar/AddToCalendar.js
index 7fbef21a..9b541171 100644
--- a/packages/web-shared/components/AddToCalendar/AddToCalendar.js
+++ b/packages/web-shared/components/AddToCalendar/AddToCalendar.js
@@ -1,4 +1,5 @@
import React from 'react';
+
import { Menu } from '@headlessui/react';
import {
CalendarPlus,
@@ -7,9 +8,10 @@ import {
MicrosoftOutlookLogo,
FileArrowDown,
} from '@phosphor-icons/react';
-import { ActionIcon, List, MenuLink } from './AddToCalendar.styles';
import { addSeconds, parseISO } from 'date-fns';
+import { ActionIcon, List, MenuLink } from './AddToCalendar.styles';
+
function convertToGoogleLink({ start, duration, location, allDay, title }) {
const startDate = parseISO(start);
const endDate = addSeconds(startDate, duration);
diff --git a/packages/web-shared/components/AddToCalendar/AddToCalendar.styles.js b/packages/web-shared/components/AddToCalendar/AddToCalendar.styles.js
index e9de00f0..f3e7b043 100644
--- a/packages/web-shared/components/AddToCalendar/AddToCalendar.styles.js
+++ b/packages/web-shared/components/AddToCalendar/AddToCalendar.styles.js
@@ -1,10 +1,10 @@
import React from 'react';
+
import { Menu } from '@headlessui/react';
-import styled from 'styled-components';
-import { withTheme } from 'styled-components';
+import { themeGet } from '@styled-system/theme-get';
import { rgba } from 'polished';
+import styled, { withTheme } from 'styled-components';
-import { themeGet } from '@styled-system/theme-get';
import { system } from '../../ui-kit/_lib/system';
export const ActionIcon = withTheme(styled(Menu.Button)`
diff --git a/packages/web-shared/components/AddToCalendar/index.js b/packages/web-shared/components/AddToCalendar/index.js
index ad0a8ee8..87cf1a92 100644
--- a/packages/web-shared/components/AddToCalendar/index.js
+++ b/packages/web-shared/components/AddToCalendar/index.js
@@ -1,2 +1,3 @@
import AddToCalendar from './AddToCalendar';
+
export default AddToCalendar;
diff --git a/packages/web-shared/components/AppHeader/AppHeader.js b/packages/web-shared/components/AppHeader/AppHeader.js
index 850577a2..013d61f3 100644
--- a/packages/web-shared/components/AppHeader/AppHeader.js
+++ b/packages/web-shared/components/AppHeader/AppHeader.js
@@ -1,11 +1,10 @@
-import Wordmark from '../Wordmark';
-import { useCurrentChurch } from '../../hooks';
-import { Box, Avatar } from '../../ui-kit';
import { User } from '@phosphor-icons/react';
-import SearchStyles from '../Searchbar/Search.styles';
-
+import { useCurrentChurch } from '../../hooks';
+import { Box } from '../../ui-kit';
import ProfileButton from '../Profile/ProfileButton';
+import SearchStyles from '../Searchbar/Search.styles';
+import Wordmark from '../Wordmark';
function ChurchLogo(props) {
const { currentChurch } = useCurrentChurch();
diff --git a/packages/web-shared/components/Auth/AuthConfirm.js b/packages/web-shared/components/Auth/AuthConfirm.js
index 444bc485..da73b888 100644
--- a/packages/web-shared/components/Auth/AuthConfirm.js
+++ b/packages/web-shared/components/Auth/AuthConfirm.js
@@ -1,15 +1,13 @@
import React, { useEffect, useState } from 'react';
-import isEmpty from 'lodash/isEmpty';
-import { useValidateLogin, useValidateRegister } from '../../hooks';
-// import amplitude from '../../libs/amplitude';
-import { update as updateAuth, useAuth } from '../../providers/AuthProvider';
+import isEmpty from 'lodash/isEmpty';
-import { Box, Button, Input } from '../../ui-kit';
import AuthLayout from './AuthLayout';
-
import authSteps from './authSteps';
+import { useValidateLogin, useValidateRegister } from '../../hooks';
import { useAnalytics } from '../../providers/AnalyticsProvider';
+import { update as updateAuth, useAuth } from '../../providers/AuthProvider';
+import { Box, Button, Input } from '../../ui-kit';
const AuthConfirm = (props) => {
const [status, setStatus] = useState('IDLE');
@@ -146,11 +144,7 @@ const AuthConfirm = (props) => {
error={error?.passcode}
/>
-
+
);
};
diff --git a/packages/web-shared/components/Auth/AuthDetails.js b/packages/web-shared/components/Auth/AuthDetails.js
index a5582b84..c2e3f24a 100644
--- a/packages/web-shared/components/Auth/AuthDetails.js
+++ b/packages/web-shared/components/Auth/AuthDetails.js
@@ -1,12 +1,11 @@
import React, { useState, useEffect } from 'react';
+import AuthLayout from './AuthLayout';
import { useForm, useUpdateProfileFields, useCurrentUser, useCompleteRegister } from '../../hooks';
import { update as updateAuth, useAuth } from '../../providers/AuthProvider';
import { Box, Button, Input, Select } from '../../ui-kit';
import authSteps from '../Auth/authSteps';
-import AuthLayout from './AuthLayout';
-
function upperFirst(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
diff --git a/packages/web-shared/components/Auth/AuthIdentity.js b/packages/web-shared/components/Auth/AuthIdentity.js
index 22f67a99..180adba5 100644
--- a/packages/web-shared/components/Auth/AuthIdentity.js
+++ b/packages/web-shared/components/Auth/AuthIdentity.js
@@ -1,11 +1,11 @@
import React, { useState } from 'react';
+import AuthLayout from './AuthLayout';
import authSteps from './authSteps';
import { useForm, useRequestLogin, useRequestRegister } from '../../hooks';
import { update as updateAuth, useAuth } from '../../providers/AuthProvider';
import { Button, Input, SmallSystemText, Box } from '../../ui-kit';
import { validateEmail, validatePhoneNumber } from '../../utils';
-import AuthLayout from './AuthLayout';
const AuthIdentity = (props) => {
const [status, setStatus] = useState('IDLE');
diff --git a/packages/web-shared/components/Auth/AuthLayout/AuthLayout.js b/packages/web-shared/components/Auth/AuthLayout/AuthLayout.js
index 410d6940..935fdc76 100644
--- a/packages/web-shared/components/Auth/AuthLayout/AuthLayout.js
+++ b/packages/web-shared/components/Auth/AuthLayout/AuthLayout.js
@@ -1,11 +1,12 @@
import React from 'react';
-import PropTypes from 'prop-types';
+
import { CaretLeft, X } from '@phosphor-icons/react';
+import PropTypes from 'prop-types';
-import { Box, Card, Button } from '../../../ui-kit';
-import customizations from './customizations';
import { Heading, SubHeading } from './AuthLayout.styles';
+import customizations from './customizations';
import { update as updateAuth, useAuth } from '../../../providers/AuthProvider';
+import { Box, Card, Button } from '../../../ui-kit';
import authSteps from '../authSteps';
function AuthLayout(props = {}) {
diff --git a/packages/web-shared/components/Auth/AuthLayout/AuthLayout.styles.js b/packages/web-shared/components/Auth/AuthLayout/AuthLayout.styles.js
index 22463b97..fa0ce600 100644
--- a/packages/web-shared/components/Auth/AuthLayout/AuthLayout.styles.js
+++ b/packages/web-shared/components/Auth/AuthLayout/AuthLayout.styles.js
@@ -1,8 +1,7 @@
import React from 'react';
-import { withTheme } from 'styled-components';
-import styled from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { withTheme } from 'styled-components';
import { TypeStyles, utils } from '../../../ui-kit';
diff --git a/packages/web-shared/components/Auth/AuthManager.js b/packages/web-shared/components/Auth/AuthManager.js
index 5ae3fecc..864331dd 100644
--- a/packages/web-shared/components/Auth/AuthManager.js
+++ b/packages/web-shared/components/Auth/AuthManager.js
@@ -1,13 +1,13 @@
import React from 'react';
-import { useAuth } from '../../providers/AuthProvider';
-import { Box } from '../../ui-kit';
import Confirm from './AuthConfirm';
import Details from './AuthDetails';
-import Merge from './AuthMerge';
import Identity from './AuthIdentity';
+import Merge from './AuthMerge';
import authSteps from './authSteps';
import Welcome from './AuthWelcome';
+import { useAuth } from '../../providers/AuthProvider';
+import { Box } from '../../ui-kit';
function AuthManager(props = {}) {
const [{ step }] = useAuth();
diff --git a/packages/web-shared/components/Auth/AuthMerge/AuthMerge.js b/packages/web-shared/components/Auth/AuthMerge/AuthMerge.js
index 3655ef6c..17b6a939 100644
--- a/packages/web-shared/components/Auth/AuthMerge/AuthMerge.js
+++ b/packages/web-shared/components/Auth/AuthMerge/AuthMerge.js
@@ -1,22 +1,10 @@
import React, { useState, useCallback, useMemo } from 'react';
-import { useForm } from '../../../hooks';
+import { Heading, SubHeading } from './AuthMerge.styles';
+import { useForm, useCompleteRegister } from '../../../hooks';
import { update as updateAuth, useAuth } from '../../../providers/AuthProvider';
-import {
- Avatar,
- Card,
- Box,
- Button,
- Input,
- H2,
- H5,
- H6,
- SmallBodyText,
-} from '../../../ui-kit';
+import { Avatar, Card, Box, Button, Input, H2, H5, H6, SmallBodyText } from '../../../ui-kit';
import authSteps from '../authSteps';
-import { useCompleteRegister } from '../../../hooks';
-
-import { Heading, SubHeading } from './AuthMerge.styles';
function AuthMerge() {
const [status, setStatus] = useState('IDLE');
@@ -48,10 +36,7 @@ function AuthMerge() {
const onSuccess = ({ birthDate, gender, firstName, lastName }) => {
setStatus('SUCCESS');
const needsOnboarding =
- firstName === null ||
- lastName === null ||
- gender === null ||
- birthDate === null;
+ firstName === null || lastName === null || gender === null || birthDate === null;
if (needsOnboarding) {
dispatch(
@@ -81,16 +66,7 @@ function AuthMerge() {
variables: { mergeProfileId },
update: (
cache,
- {
- data: {
- completeRegistration: {
- birthDate,
- gender,
- firstName,
- lastName,
- } = {},
- } = {},
- }
+ { data: { completeRegistration: { birthDate, gender, firstName, lastName } = {} } = {} }
) => {
onSuccess({ birthDate, gender, firstName, lastName });
},
@@ -121,8 +97,7 @@ function AuthMerge() {
Are any of these people you?
- Based on your verified phone number or email, we've matched you to an
- existing profile.
+ Based on your verified phone number or email, we've matched you to an existing profile.
{allOptions.map((item, index) => (
@@ -136,14 +111,10 @@ function AuthMerge() {
checked={item.id === mergeProfileId}
onChange={onChange}
/>
- {item.photo?.uri ? (
-
- ) : null}
+ {item.photo?.uri ? : null}
{item.firstName}
-
- {item.lastName}
-
+ {item.lastName}
))}
diff --git a/packages/web-shared/components/Auth/AuthMerge/AuthMerge.styles.js b/packages/web-shared/components/Auth/AuthMerge/AuthMerge.styles.js
index 3eb1e712..0b235284 100644
--- a/packages/web-shared/components/Auth/AuthMerge/AuthMerge.styles.js
+++ b/packages/web-shared/components/Auth/AuthMerge/AuthMerge.styles.js
@@ -1,8 +1,7 @@
import React from 'react';
-import { withTheme } from 'styled-components';
-import styled, { css } from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { withTheme, css } from 'styled-components';
import { system, TypeStyles, utils } from '../../../ui-kit';
diff --git a/packages/web-shared/components/Auth/AuthWelcome.js b/packages/web-shared/components/Auth/AuthWelcome.js
index bf2f6f73..e7770f92 100644
--- a/packages/web-shared/components/Auth/AuthWelcome.js
+++ b/packages/web-shared/components/Auth/AuthWelcome.js
@@ -1,9 +1,9 @@
import React from 'react';
-import { update as updateAuth, useAuth } from '../../providers/AuthProvider';
-import { Box, Button } from '../../ui-kit';
import AuthLayout from './AuthLayout';
import steps from './authSteps';
+import { update as updateAuth, useAuth } from '../../providers/AuthProvider';
+import { Box, Button } from '../../ui-kit';
const AuthWelcome = (props) => {
const [state, dispatch] = useAuth();
diff --git a/packages/web-shared/components/Auth/BirthDateField/BirthDateField.styles.web.js b/packages/web-shared/components/Auth/BirthDateField/BirthDateField.styles.web.js
index fa82708f..149e5bf4 100644
--- a/packages/web-shared/components/Auth/BirthDateField/BirthDateField.styles.web.js
+++ b/packages/web-shared/components/Auth/BirthDateField/BirthDateField.styles.web.js
@@ -1,7 +1,6 @@
-import styled from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
-
import { system, utils } from 'shared/ui-kit';
+import styled from 'styled-components';
const BirthDateField = styled.div`
position: relative;
diff --git a/packages/web-shared/components/Auth/BirthDateField/BirthDateField.web.js b/packages/web-shared/components/Auth/BirthDateField/BirthDateField.web.js
index c3693b2b..5b765067 100644
--- a/packages/web-shared/components/Auth/BirthDateField/BirthDateField.web.js
+++ b/packages/web-shared/components/Auth/BirthDateField/BirthDateField.web.js
@@ -1,7 +1,8 @@
import React from 'react';
-import PropTypes from 'prop-types';
+import PropTypes from 'prop-types';
import { Box, LargeSystemText } from 'shared/ui-kit';
+
import Styled from './BirthDateField.styles.web';
function BirthDateField(props = {}) {
@@ -9,12 +10,7 @@ function BirthDateField(props = {}) {
<>
Birth Date
-
+
{props.error ? (
{props.error}
diff --git a/packages/web-shared/components/Auth/GenderField/GenderField.js b/packages/web-shared/components/Auth/GenderField/GenderField.js
index f31f1c3b..55e6bb37 100644
--- a/packages/web-shared/components/Auth/GenderField/GenderField.js
+++ b/packages/web-shared/components/Auth/GenderField/GenderField.js
@@ -1,4 +1,5 @@
import React from 'react';
+
import PropTypes from 'prop-types';
import { Box, LargeSystemText, Select } from '../../../ui-kit';
@@ -8,12 +9,7 @@ function GenderField(props = {}) {
<>
Gender
-
diff --git a/packages/web-shared/components/Profile/canvasPreview.js b/packages/web-shared/components/Profile/canvasPreview.js
index 2baf782c..22898ad7 100644
--- a/packages/web-shared/components/Profile/canvasPreview.js
+++ b/packages/web-shared/components/Profile/canvasPreview.js
@@ -1,12 +1,6 @@
const TO_RADIANS = Math.PI / 180;
-export async function canvasPreview(
- image,
- canvas,
- crop,
- scale = 1,
- rotate = 0
-) {
+export async function canvasPreview(image, canvas, crop, scale = 1, rotate = 0) {
const ctx = canvas.getContext('2d');
if (!ctx) {
@@ -15,11 +9,13 @@ export async function canvasPreview(
const scaleX = image.naturalWidth / image.width;
const scaleY = image.naturalHeight / image.height;
+
// devicePixelRatio slightly increases sharpness on retina devices
// at the expense of slightly slower render times and needing to
// size the image back down if you want to download/upload and be
// true to the images natural size.
const pixelRatio = window.devicePixelRatio;
+
// const pixelRatio = 1
canvas.width = Math.floor(crop.width * scaleX * pixelRatio);
@@ -39,12 +35,16 @@ export async function canvasPreview(
// 5) Move the crop origin to the canvas origin (0,0)
ctx.translate(-cropX, -cropY);
+
// 4) Move the origin to the center of the original position
ctx.translate(centerX, centerY);
+
// 3) Rotate around the origin
ctx.rotate(rotateRads);
+
// 2) Scale the image
ctx.scale(scale, scale);
+
// 1) Move the center of the image to the origin (0,0)
ctx.translate(-centerX, -centerY);
ctx.drawImage(
diff --git a/packages/web-shared/components/Searchbar/Autocomplete.js b/packages/web-shared/components/Searchbar/Autocomplete.js
index 2ce6fa3a..8923c10c 100644
--- a/packages/web-shared/components/Searchbar/Autocomplete.js
+++ b/packages/web-shared/components/Searchbar/Autocomplete.js
@@ -1,16 +1,16 @@
import React, { useEffect, useRef, useMemo, useState } from 'react';
-import { X } from '@phosphor-icons/react';
-import algoliasearch from 'algoliasearch/lite';
import { createAutocomplete } from '@algolia/autocomplete-core';
-import { getAlgoliaResults } from '@algolia/autocomplete-preset-algolia';
import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions';
import { createLocalStorageRecentSearchesPlugin } from '@algolia/autocomplete-plugin-recent-searches';
+import { getAlgoliaResults } from '@algolia/autocomplete-preset-algolia';
+import { X } from '@phosphor-icons/react';
+import algoliasearch from 'algoliasearch/lite';
import '@algolia/autocomplete-theme-classic';
+import Styled from './Search.styles';
import { useSearchState } from '../../providers/SearchProvider';
import { getURLFromType } from '../../utils';
-import Styled from './Search.styles';
const MOBILE_BREAKPOINT = 428;
const appId = 'Z0GWPR8XBE';
@@ -144,6 +144,7 @@ export default function Autocomplete({
block: 'start',
});
}
+
// (2) Synchronize the Autocomplete state with the React state.
setAutocompleteState(state);
},
@@ -171,6 +172,7 @@ export default function Autocomplete({
hitsPerPage: 4,
clickAnalytics: true,
getRankingInfo: true,
+
// highlightPreTag: '',
// highlightPostTag: '',
},
@@ -194,30 +196,30 @@ export default function Autocomplete({
getItems({ query }) {
return getAlgoliaResults({
searchClient,
-queries: [
- {
- indexName: `ContentItem_${searchState.church}`,
- query,
- params: {
- hitsPerPage: 8,
- clickAnalytics: true,
- getRankingInfo: true,
- },
- },
- ...(hasEventIndex
- ? [
- {
- indexName: `Event_${searchState.church}`,
- query,
- params: {
- hitsPerPage: 8,
- clickAnalytics: true,
- getRankingInfo: true,
- },
- },
- ]
- : []),
-],
+ queries: [
+ {
+ indexName: `ContentItem_${searchState.church}`,
+ query,
+ params: {
+ hitsPerPage: 8,
+ clickAnalytics: true,
+ getRankingInfo: true,
+ },
+ },
+ ...(hasEventIndex
+ ? [
+ {
+ indexName: `Event_${searchState.church}`,
+ query,
+ params: {
+ hitsPerPage: 8,
+ clickAnalytics: true,
+ getRankingInfo: true,
+ },
+ },
+ ]
+ : []),
+ ],
});
},
getItemUrl({ item }) {
diff --git a/packages/web-shared/components/Searchbar/Search.styles.js b/packages/web-shared/components/Searchbar/Search.styles.js
index 33014a36..0651ed63 100644
--- a/packages/web-shared/components/Searchbar/Search.styles.js
+++ b/packages/web-shared/components/Searchbar/Search.styles.js
@@ -1,10 +1,9 @@
-import { withTheme } from 'styled-components';
-import styled, { css } from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { withTheme, css } from 'styled-components';
-import { H4, TypeStyles } from '../../ui-kit/Typography';
import { utils } from '../../ui-kit';
import { system } from '../../ui-kit/_lib/system';
+import { H4, TypeStyles } from '../../ui-kit/Typography';
const showDropdown = ({ dropdown }) => {
if (dropdown) {
diff --git a/packages/web-shared/components/Searchbar/SearchResults.js b/packages/web-shared/components/Searchbar/SearchResults.js
index 77f07fde..1bae796c 100644
--- a/packages/web-shared/components/Searchbar/SearchResults.js
+++ b/packages/web-shared/components/Searchbar/SearchResults.js
@@ -2,16 +2,16 @@ import React, { useEffect, useState, createElement, Fragment } from 'react';
import '@algolia/autocomplete-theme-classic';
import { parseAlgoliaHitHighlight } from '@algolia/autocomplete-preset-algolia';
+import { ClockCounterClockwise, MagnifyingGlass, CaretRight, X } from '@phosphor-icons/react';
-import { useSearchState } from '../../providers/SearchProvider';
+import { recentSearchesPlugin } from './Autocomplete';
import { FeatureFeedProvider } from '../../providers';
-import Feed from '../FeatureFeed';
-import { ResourceCard, Box } from '../../ui-kit';
-
-import { getURLFromType } from '../../utils';
import { open as openModal, set as setModal, useModal } from '../../providers/ModalProvider';
-import { ClockCounterClockwise, MagnifyingGlass, CaretRight, X } from '@phosphor-icons/react';
import { useNavigation } from '../../providers/NavigationProvider';
+import { useSearchState } from '../../providers/SearchProvider';
+import { ResourceCard, Box } from '../../ui-kit';
+import { getURLFromType } from '../../utils';
+import Feed from '../FeatureFeed';
function Hit({ hit }) {
return hit?.title;
@@ -164,6 +164,7 @@ const SearchResults = ({ autocompleteState, autocomplete }) => {
.forEach((collection) => {
allResults.push(...collection.items.map((item) => ({ ...item, source: collection.source })));
});
+
// Algolia adds a _rankingInfo property to each item, which we can use to sort the results
// We want to sort the results first by nbExactWords (desc), then proximityDistance (asc), then last by userScore (desc)
// This is super hacky and results are not to be guaranteed, but should improve results over displaying them in the order they come back
@@ -214,6 +215,7 @@ const SearchResults = ({ autocompleteState, autocomplete }) => {
{autocompleteState.isOpen &&
autocompleteState.collections.map((collection, index) => {
const { source, items } = collection;
+
// Rendering of Query Suggestions
if (['querySuggestionsPlugin'].includes(collection.source.sourceId)) {
return (
@@ -288,41 +290,38 @@ const SearchResults = ({ autocompleteState, autocomplete }) => {
);
}
})}
- {
- // Rendering of regular items
- autocompleteState.query !== '' ? (
-
-
- {allResults.map((item) => (
-
- {
- if (item.source.sourceId === 'pages') {
- return handleStaticActionPress(item);
- }
- return handleActionPress(item);
- }}
- background="none"
- />
-
- ))}
-
-
- ) : null
- }
+ {autocompleteState.query !== '' ? (
+
+
+ {allResults.map((item) => (
+
+ {
+ if (item.source.sourceId === 'pages') {
+ return handleStaticActionPress(item);
+ }
+ return handleActionPress(item);
+ }}
+ background="none"
+ />
+
+ ))}
+
+
+ ) : null}
{autocompleteState.isOpen && autocompleteState.query === '' && searchState.searchFeed ? (
{
@@ -36,8 +34,8 @@ const Searchbar = (props = {}) => {
const [isMobile, setIsMobile] = useState(false);
const [scrollPosition, setScrollPosition] = useState(0);
+ // 0.35ch works out visually to be the width of a
const textWelcome = (
- // 0.35ch works out visually to be the width of a
Hey{firstName !== '' ? ` ${firstName}` : ''}!
);
diff --git a/packages/web-shared/components/StoreLinks/StoreLinks.js b/packages/web-shared/components/StoreLinks/StoreLinks.js
index 86503885..5aa890eb 100644
--- a/packages/web-shared/components/StoreLinks/StoreLinks.js
+++ b/packages/web-shared/components/StoreLinks/StoreLinks.js
@@ -1,8 +1,7 @@
-import { Box } from '../../ui-kit';
-import { useCurrentChurch } from '../../hooks';
-
import downloadOnAppStore from './download-on-app-store';
import downloadOnPlayStore from './download-on-play-store';
+import { useCurrentChurch } from '../../hooks';
+import { Box } from '../../ui-kit';
const AppStoreLink = () => ;
diff --git a/packages/web-shared/components/VideoPlayer/DevVideoDetails.js b/packages/web-shared/components/VideoPlayer/DevVideoDetails.js
index 45f49c1d..b2063ab2 100644
--- a/packages/web-shared/components/VideoPlayer/DevVideoDetails.js
+++ b/packages/web-shared/components/VideoPlayer/DevVideoDetails.js
@@ -1,5 +1,6 @@
/* eslint-disable react/prop-types */
import React from 'react';
+
import { Box, SmallBodyText } from '../../ui-kit';
export default function DevVideoDetails({
@@ -11,14 +12,7 @@ export default function DevVideoDetails({
progressTime,
}) {
return (
-
+
parentNode.id:
{`\n${parentNode.id}`}
@@ -32,16 +26,13 @@ export default function DevVideoDetails({
{`\n${videoMedia.id}\n`}
- paused:{' '}
- {paused.toString()}
+ paused: {paused.toString()}
- currentTime:{' '}
- {currentTime}
+ currentTime: {currentTime}
- progressTime:{' '}
- {progressTime}
+ progressTime: {progressTime}
duration: {duration} (
diff --git a/packages/web-shared/components/VideoPlayer/VideoPlayer.js b/packages/web-shared/components/VideoPlayer/VideoPlayer.js
index 5243681d..8a2adba6 100644
--- a/packages/web-shared/components/VideoPlayer/VideoPlayer.js
+++ b/packages/web-shared/components/VideoPlayer/VideoPlayer.js
@@ -1,12 +1,13 @@
import React, { useCallback, useRef, useState, useEffect, useMemo } from 'react';
+
+import { get } from 'lodash';
import PropTypes from 'prop-types';
-import { useInteractWithNode, useLivestreamStatus, useHTMLContent } from '../../hooks';
-import { Box } from '../../ui-kit';
import { EmbededPlayer, VideoPlayer as Player } from './VideoPlayer.styles';
import amplitude from '../../analytics/amplitude';
+import { useInteractWithNode, useLivestreamStatus, useHTMLContent } from '../../hooks';
import { useAnalytics } from '../../providers/AnalyticsProvider';
-import { get } from 'lodash';
+import { Box } from '../../ui-kit';
const PROGRESS_CHECK_INTERVAL_SECONDS = 10;
@@ -147,6 +148,7 @@ function VideoPlayer(props = {}) {
// TODO: Is this needed? According to Apollos TV/Roku Segment Events: totalLength => Total length of the video, in seconds
// Total length of the video is passed in with video source props: props.parentNode.videos[0].duration
const newDuration = Math.floor(evt.duration, 2);
+
// _analyticsData.totalLength = newDuration;
setDuration(newDuration);
diff --git a/packages/web-shared/components/VideoPlayer/VideoPlayer.styles.js b/packages/web-shared/components/VideoPlayer/VideoPlayer.styles.js
index d18563ac..b2d69b05 100644
--- a/packages/web-shared/components/VideoPlayer/VideoPlayer.styles.js
+++ b/packages/web-shared/components/VideoPlayer/VideoPlayer.styles.js
@@ -1,6 +1,6 @@
-import styled from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
import ReactPlayer from 'react-player';
+import styled from 'styled-components';
import { system } from '../../ui-kit';
diff --git a/packages/web-shared/components/Wordmark/Wordmark.js b/packages/web-shared/components/Wordmark/Wordmark.js
index 6d93c1a1..6fa8e89a 100644
--- a/packages/web-shared/components/Wordmark/Wordmark.js
+++ b/packages/web-shared/components/Wordmark/Wordmark.js
@@ -1,8 +1,9 @@
import React from 'react';
+
import PropTypes from 'prop-types';
import { withTheme } from 'styled-components';
-import Styled from './Wordmark.styles';
+import Styled from './Wordmark.styles';
import { systemPropTypes } from '../../ui-kit';
function Wordmark({ size, source, href, ref }) {
diff --git a/packages/web-shared/components/Wordmark/Wordmark.styles.js b/packages/web-shared/components/Wordmark/Wordmark.styles.js
index 6e9d9e51..6bcacf95 100644
--- a/packages/web-shared/components/Wordmark/Wordmark.styles.js
+++ b/packages/web-shared/components/Wordmark/Wordmark.styles.js
@@ -1,5 +1,4 @@
-import { withTheme } from 'styled-components';
-import styled, { css } from 'styled-components';
+import styled, { withTheme, css } from 'styled-components';
const DEFAULT_ICON_SIZE = '80px';
diff --git a/packages/web-shared/components/index.js b/packages/web-shared/components/index.js
index c24e40ac..e136aa3d 100644
--- a/packages/web-shared/components/index.js
+++ b/packages/web-shared/components/index.js
@@ -1,9 +1,9 @@
import AuthManager from './Auth';
import ContentChannel from './ContentChannel';
-import ContentSingle from './ContentSingle';
import ContentSeriesSingle from './ContentSeriesSingle';
-import FeatureFeedList from './FeatureFeedList';
+import ContentSingle from './ContentSingle';
import Feed from './FeatureFeed';
+import FeatureFeedList from './FeatureFeedList';
import LivestreamSingle from './LivestreamSingle';
import Logo from './Logo';
import Modal from './Modal';
diff --git a/packages/web-shared/embeds/Auth.js b/packages/web-shared/embeds/Auth.js
index d5e088ce..b1f60670 100644
--- a/packages/web-shared/embeds/Auth.js
+++ b/packages/web-shared/embeds/Auth.js
@@ -1,4 +1,5 @@
import React from 'react';
+
import { AuthManager } from '../components';
import { AUTH_TOKEN_KEY } from '../config/keys';
diff --git a/packages/web-shared/embeds/FeatureFeed.js b/packages/web-shared/embeds/FeatureFeed.js
index f50b599f..b28f39f2 100644
--- a/packages/web-shared/embeds/FeatureFeed.js
+++ b/packages/web-shared/embeds/FeatureFeed.js
@@ -1,12 +1,13 @@
import React, { useEffect } from 'react';
-import { FeatureFeedProvider } from '../providers';
+
import { FeatureFeedList, Modal } from '../components';
+import { FeatureFeedProvider } from '../providers';
+import { useAnalytics } from '../providers/AnalyticsProvider';
import { useModalState } from '../providers/ModalProvider';
+import { useNavigation } from '../providers/NavigationProvider';
import { Box } from '../ui-kit';
import { parseSlugToIdAndType } from '../utils';
-import { useAnalytics } from '../providers/AnalyticsProvider';
import { getComponentFromType } from '../utils/getContentFromURL';
-import { useNavigation } from '../providers/NavigationProvider';
function RenderFeatures(props) {
const { id } = useNavigation();
@@ -17,6 +18,7 @@ function RenderFeatures(props) {
if (Component) {
return Component;
}
+
// If not component is found, fallback to a FeatureFeed
return (
diff --git a/packages/web-shared/embeds/Main.js b/packages/web-shared/embeds/Main.js
index b63dd930..7519d430 100644
--- a/packages/web-shared/embeds/Main.js
+++ b/packages/web-shared/embeds/Main.js
@@ -1,16 +1,14 @@
import React from 'react';
-import { createPortal } from 'react-dom';
-import { Searchbar } from '../components';
+import { createPortal } from 'react-dom';
+import Styled from './Search.styles';
+import { Searchbar, FeatureFeedList, Modal } from '../components';
import { FeatureFeedProvider } from '../providers';
-import { FeatureFeedList, Modal } from '../components';
+import NavigationProvider from '../providers/NavigationProvider';
import { useSearchState } from '../providers/SearchProvider';
import { Box } from '../ui-kit';
-import Styled from './Search.styles';
-import NavigationProvider from '../providers/NavigationProvider';
-
function RenderEmbed(props) {
const searchState = useSearchState();
diff --git a/packages/web-shared/embeds/Search.js b/packages/web-shared/embeds/Search.js
index 4ef3be04..ec5c4857 100644
--- a/packages/web-shared/embeds/Search.js
+++ b/packages/web-shared/embeds/Search.js
@@ -1,10 +1,10 @@
import React, { useRef, useState } from 'react';
-import { useSearchParams } from 'react-router-dom';
-import { Searchbar } from '../components';
+import { useSearchParams } from 'react-router-dom';
-import { ContentItemProvider, FeatureFeedProvider, ContentFeedProvider } from '../providers';
+import Styled from './Search.styles';
import {
+ Searchbar,
ContentChannel,
ContentSeriesSingle,
ContentSingle,
@@ -12,12 +12,11 @@ import {
LivestreamSingle,
Modal,
} from '../components';
+import { ContentItemProvider, FeatureFeedProvider, ContentFeedProvider } from '../providers';
import { useModalState } from '../providers/ModalProvider';
+import { useNavigation } from '../providers/NavigationProvider';
import { useSearchState } from '../providers/SearchProvider';
import { Box } from '../ui-kit';
-import { useNavigation } from '../providers/NavigationProvider';
-
-import Styled from './Search.styles';
function RenderFeatures(props) {
const { id } = useNavigation();
diff --git a/packages/web-shared/embeds/index.js b/packages/web-shared/embeds/index.js
index 1d645cb5..8273ba01 100644
--- a/packages/web-shared/embeds/index.js
+++ b/packages/web-shared/embeds/index.js
@@ -1,6 +1,6 @@
import Auth from './Auth';
import FeatureFeed from './FeatureFeed';
-import Search from './Search';
import Main from './Main';
+import Search from './Search';
export { Auth, FeatureFeed, Search, Main };
diff --git a/packages/web-shared/hooks/useAuthQuery.js b/packages/web-shared/hooks/useAuthQuery.js
index 06975e21..66a6d9d2 100644
--- a/packages/web-shared/hooks/useAuthQuery.js
+++ b/packages/web-shared/hooks/useAuthQuery.js
@@ -1,4 +1,5 @@
import { useCallback, useEffect } from 'react';
+
import { useQuery } from '@apollo/client';
import { useAuth, logout } from '../providers/AuthProvider';
@@ -6,17 +7,21 @@ import { useAuth, logout } from '../providers/AuthProvider';
const useAuthQuery = (query, options = {}) => {
const [state, dispatch] = useAuth();
const { token, authenticated } = state;
- const { data, error, loading, refetch: _refetch } =
- useQuery(query, {
- skip: !authenticated,
- fetchPolicy: 'network-only',
- onError: () => {
- // eslint-disable-next-line no-console
- console.warn('Authentication error: logging out...');
- dispatch(logout());
- },
- ...options,
- }) || {};
+ const {
+ data,
+ error,
+ loading,
+ refetch: _refetch,
+ } = useQuery(query, {
+ skip: !authenticated,
+ fetchPolicy: 'network-only',
+ onError: () => {
+ // eslint-disable-next-line no-console
+ console.warn('Authentication error: logging out...');
+ dispatch(logout());
+ },
+ ...options,
+ }) || {};
// There's a bug where the query from `useQuery` is `undefined`
// and will throw an error in the `useEffect` down below.
diff --git a/packages/web-shared/hooks/useCompleteRegister.js b/packages/web-shared/hooks/useCompleteRegister.js
index 846ff13f..aa682a5a 100644
--- a/packages/web-shared/hooks/useCompleteRegister.js
+++ b/packages/web-shared/hooks/useCompleteRegister.js
@@ -1,14 +1,8 @@
import { gql, useMutation } from '@apollo/client';
export const COMPLETE_REGISTER = gql`
- mutation completeRegistration(
- $mergeProfileId: ID
- $profileInput: [UpdateProfileInput]
- ) {
- completeRegistration(
- mergeProfileId: $mergeProfileId
- profileInput: $profileInput
- ) {
+ mutation completeRegistration($mergeProfileId: ID, $profileInput: [UpdateProfileInput]) {
+ completeRegistration(mergeProfileId: $mergeProfileId, profileInput: $profileInput) {
id
birthDate
gender
diff --git a/packages/web-shared/hooks/useContentItem.js b/packages/web-shared/hooks/useContentItem.js
index 5a130726..a4ce66fe 100644
--- a/packages/web-shared/hooks/useContentItem.js
+++ b/packages/web-shared/hooks/useContentItem.js
@@ -1,4 +1,5 @@
import { gql, useQuery } from '@apollo/client';
+
import {
VIDEO_MEDIA_FIELDS,
CONTENT_NODE_FRAGMENT,
diff --git a/packages/web-shared/hooks/useFeatureFeed.js b/packages/web-shared/hooks/useFeatureFeed.js
index f6ebd77b..c1836ff8 100644
--- a/packages/web-shared/hooks/useFeatureFeed.js
+++ b/packages/web-shared/hooks/useFeatureFeed.js
@@ -1,4 +1,5 @@
import { gql, useQuery } from '@apollo/client';
+
import { VIDEO_MEDIA_FIELDS, CONTENT_CARD_FRAGMENT } from '../fragments';
export const FEED_FEATURES = gql`
diff --git a/packages/web-shared/hooks/useHTMLContent.js b/packages/web-shared/hooks/useHTMLContent.js
index 0bca4f3e..b4276277 100644
--- a/packages/web-shared/hooks/useHTMLContent.js
+++ b/packages/web-shared/hooks/useHTMLContent.js
@@ -1,5 +1,7 @@
-import DOMPurify from 'dompurify';
import { useCallback } from 'react';
+
+import DOMPurify from 'dompurify';
+
import useLink from './useLink';
const useHTMLContent = () => {
@@ -13,7 +15,7 @@ const useHTMLContent = () => {
const parser = new DOMParser();
const doc = parser.parseFromString(sanitizedHTML, 'text/html');
- const transformAnchorTag = anchorTag => {
+ const transformAnchorTag = (anchorTag) => {
if (!anchorTag) return;
const link = anchorTag.getAttribute('href');
@@ -40,7 +42,7 @@ const useHTMLContent = () => {
return doc.body.innerHTML;
},
- [transformLink],
+ [transformLink]
);
return parseHTMLContent;
diff --git a/packages/web-shared/hooks/useHandleActionPress.js b/packages/web-shared/hooks/useHandleActionPress.js
index 9367f71f..77043189 100644
--- a/packages/web-shared/hooks/useHandleActionPress.js
+++ b/packages/web-shared/hooks/useHandleActionPress.js
@@ -1,8 +1,7 @@
-import { getURLFromType } from '../utils';
-
-import { open as openModal, set as setModal, useModal } from '../providers/ModalProvider';
import { useAnalytics } from '../providers/AnalyticsProvider';
+import { open as openModal, set as setModal, useModal } from '../providers/ModalProvider';
import { useNavigation } from '../providers/NavigationProvider';
+import { getURLFromType } from '../utils';
export const useHandleActionPress = () => {
const [state, dispatch] = useModal();
diff --git a/packages/web-shared/hooks/useInteractWithNode.js b/packages/web-shared/hooks/useInteractWithNode.js
index 85837c40..b55ca40a 100644
--- a/packages/web-shared/hooks/useInteractWithNode.js
+++ b/packages/web-shared/hooks/useInteractWithNode.js
@@ -1,6 +1,7 @@
+import { useCallback } from 'react';
+
import { gql, useMutation } from '@apollo/client';
import isObject from 'lodash/isObject';
-import { useCallback } from 'react';
import { useAuthState } from '../providers/AuthProvider';
@@ -33,12 +34,10 @@ function transformVariables(variables) {
// Map the `data` object to an array of key/value pairs,
// to conform to InteractionDataField schema
- const transformedData = Object.entries(variables?.data).map(
- ([field, value]) => ({
- field,
- value,
- })
- );
+ const transformedData = Object.entries(variables?.data).map(([field, value]) => ({
+ field,
+ value,
+ }));
return {
...variables,
diff --git a/packages/web-shared/hooks/useLink.js b/packages/web-shared/hooks/useLink.js
index e69d26c3..cec8a695 100644
--- a/packages/web-shared/hooks/useLink.js
+++ b/packages/web-shared/hooks/useLink.js
@@ -1,7 +1,9 @@
import { useCallback } from 'react';
+
import { parse } from 'tldts';
-import { isValidUrl } from '../utils';
+
import useCurrentUser from './useCurrentUser';
+import { isValidUrl } from '../utils';
const useLink = () => {
const { currentUser } = useCurrentUser();
@@ -34,7 +36,7 @@ const useLink = () => {
return formattedUrl;
},
- [rockAuthToken, currentUrl, parse],
+ [rockAuthToken, currentUrl, parse]
);
return transformLink;
diff --git a/packages/web-shared/hooks/useLivestreamStatus.js b/packages/web-shared/hooks/useLivestreamStatus.js
index 8150d3ba..3c542c34 100644
--- a/packages/web-shared/hooks/useLivestreamStatus.js
+++ b/packages/web-shared/hooks/useLivestreamStatus.js
@@ -1,4 +1,5 @@
import { useState, useEffect } from 'react';
+
import {
isWithinInterval,
isBefore,
@@ -45,19 +46,25 @@ const useLivestreamStatus = (livestream) => {
if (isBefore(now, liveStreamStart)) {
setComingUp(true);
timeouts.push(
- setTimeout(() => {
- setComingUp(false);
- setIsLive(true);
- }, differenceInMilliseconds(liveStreamStart, now))
+ setTimeout(
+ () => {
+ setComingUp(false);
+ setIsLive(true);
+ },
+ differenceInMilliseconds(liveStreamStart, now)
+ )
);
}
// The current time is before the Live Stream ENDS, so we need to trigger the state to disable the label when it's no longer live
if (isBefore(now, liveStreamEnd)) {
timeouts.push(
- setTimeout(() => {
- setIsLive(false);
- }, differenceInMilliseconds(liveStreamEnd, now))
+ setTimeout(
+ () => {
+ setIsLive(false);
+ },
+ differenceInMilliseconds(liveStreamEnd, now)
+ )
);
}
diff --git a/packages/web-shared/hooks/useValidateLogin.js b/packages/web-shared/hooks/useValidateLogin.js
index e8b73fb0..6fbbf95a 100644
--- a/packages/web-shared/hooks/useValidateLogin.js
+++ b/packages/web-shared/hooks/useValidateLogin.js
@@ -1,10 +1,7 @@
import { gql, useMutation } from '@apollo/client';
export const VALIDATE_LOGIN = gql`
- mutation validateLogin(
- $identity: AuthenticationIdentityInput!
- $otp: String!
- ) {
+ mutation validateLogin($identity: AuthenticationIdentityInput!, $otp: String!) {
validateLogin(identity: $identity, otp: $otp) {
person {
firstName
diff --git a/packages/web-shared/hooks/useValidateRegister.js b/packages/web-shared/hooks/useValidateRegister.js
index eeca8766..ad993446 100644
--- a/packages/web-shared/hooks/useValidateRegister.js
+++ b/packages/web-shared/hooks/useValidateRegister.js
@@ -1,10 +1,7 @@
import { gql, useMutation } from '@apollo/client';
export const VALIDATE_REGISTER = gql`
- mutation validateRegister(
- $identity: AuthenticationIdentityInput!
- $otp: String!
- ) {
+ mutation validateRegister($identity: AuthenticationIdentityInput!, $otp: String!) {
validateRegister(identity: $identity, otp: $otp) {
person {
firstName
diff --git a/packages/web-shared/package.json b/packages/web-shared/package.json
index c474a724..2ca1620a 100644
--- a/packages/web-shared/package.json
+++ b/packages/web-shared/package.json
@@ -4,6 +4,9 @@
"main": "index.js",
"license": "MIT",
"private": true,
+ "scripts": {
+ "lint": "eslint --cache --cache-location ./node_modules/.cache/eslint ."
+ },
"dependencies": {
"@apollo/client": "^3.9.9",
"@babel/preset-react": "^7.22.5",
diff --git a/packages/web-shared/providers/AnalyticsProvider.js b/packages/web-shared/providers/AnalyticsProvider.js
index 39351354..c18133d4 100644
--- a/packages/web-shared/providers/AnalyticsProvider.js
+++ b/packages/web-shared/providers/AnalyticsProvider.js
@@ -1,10 +1,12 @@
import React, { createContext, useContext, useMemo, useEffect, useRef } from 'react';
+
import { gql, useQuery } from '@apollo/client';
-import { useCurrentChurch, useCurrentUser } from '../hooks';
+import { isbot } from 'isbot';
+
+import { useAuth } from './AuthProvider';
import amplitude from '../analytics/amplitude';
import clientFactory from '../analytics/segment';
-import { useAuth } from './AuthProvider';
-import { isbot } from 'isbot';
+import { useCurrentChurch, useCurrentUser } from '../hooks';
const Context = createContext();
const isDev = process.env.NODE_ENV !== 'production';
diff --git a/packages/web-shared/providers/AppProvider.js b/packages/web-shared/providers/AppProvider.js
index 8742ebae..56b4c4eb 100644
--- a/packages/web-shared/providers/AppProvider.js
+++ b/packages/web-shared/providers/AppProvider.js
@@ -1,13 +1,14 @@
import React, { useState, useEffect, createContext, useContext } from 'react';
-import PropTypes from 'prop-types';
+
import { ApolloProvider } from '@apollo/client';
+import PropTypes from 'prop-types';
-import initClient from '../client';
-import { ThemeProvider } from '../ui-kit';
-import AuthProvider from './AuthProvider';
import AnalyticsProvider from './AnalyticsProvider';
+import AuthProvider from './AuthProvider';
import ModalProvider from './ModalProvider';
import SearchProvider from './SearchProvider';
+import initClient from '../client';
+import { ThemeProvider } from '../ui-kit';
const UseApollosIdParamContext = createContext(false);
diff --git a/packages/web-shared/providers/AuthProvider.js b/packages/web-shared/providers/AuthProvider.js
index cd2e82ca..225fdaf3 100644
--- a/packages/web-shared/providers/AuthProvider.js
+++ b/packages/web-shared/providers/AuthProvider.js
@@ -1,11 +1,11 @@
-import PropTypes from 'prop-types';
import React, { createContext, useContext, useEffect, useReducer } from 'react';
+import { useApolloClient } from '@apollo/client';
+import PropTypes from 'prop-types';
import { v4 as uuidv4 } from 'uuid';
import authSteps from '../components/Auth/authSteps';
import { ANONYMOUS_ID, AUTH_REFRESH_TOKEN_KEY, AUTH_TOKEN_KEY } from '../config/keys';
-import { useApolloClient } from '@apollo/client';
const AuthStateContext = createContext();
const AuthDispatchContext = createContext();
diff --git a/packages/web-shared/providers/ContentFeedProvider.js b/packages/web-shared/providers/ContentFeedProvider.js
index 3e00be6f..7606d287 100644
--- a/packages/web-shared/providers/ContentFeedProvider.js
+++ b/packages/web-shared/providers/ContentFeedProvider.js
@@ -1,4 +1,5 @@
import React from 'react';
+
import PropTypes from 'prop-types';
import { useContentFeed } from '../hooks';
@@ -7,22 +8,12 @@ function ContentFeedProvider({ Component, options, ...props }) {
const { loading, error, content, fetchMore } = useContentFeed(options);
return (
-
+
);
}
ContentFeedProvider.propTypes = {
- Component: PropTypes.oneOfType([
- PropTypes.node,
- PropTypes.func,
- PropTypes.object,
- ]),
+ Component: PropTypes.oneOfType([PropTypes.node, PropTypes.func, PropTypes.object]),
options: PropTypes.shape({}),
};
diff --git a/packages/web-shared/providers/ContentItemProvider.js b/packages/web-shared/providers/ContentItemProvider.js
index 005fd708..f554dc29 100644
--- a/packages/web-shared/providers/ContentItemProvider.js
+++ b/packages/web-shared/providers/ContentItemProvider.js
@@ -1,4 +1,5 @@
import React from 'react';
+
import PropTypes from 'prop-types';
import { useContentItem } from '../hooks';
@@ -6,7 +7,6 @@ import { useContentItem } from '../hooks';
function ContentItemProvider({ Component, options }) {
const { loading, error, item } = useContentItem(options);
-
return ;
}
diff --git a/packages/web-shared/providers/FeatureFeedProvider.js b/packages/web-shared/providers/FeatureFeedProvider.js
index 53011133..81454b49 100644
--- a/packages/web-shared/providers/FeatureFeedProvider.js
+++ b/packages/web-shared/providers/FeatureFeedProvider.js
@@ -1,4 +1,5 @@
import React from 'react';
+
import PropTypes from 'prop-types';
import { useFeatureFeed } from '../hooks';
@@ -7,23 +8,15 @@ function FeatureFeedProvider({ Component, options, ...props }) {
const { loading, error, features } = useFeatureFeed(options);
if (!Component) {
- console.error(
- 'FeatureFeedProvider was not given a Component to use. Cannot render.'
- );
+ console.error('FeatureFeedProvider was not given a Component to use. Cannot render.');
return null;
}
- return (
-
- );
+ return ;
}
FeatureFeedProvider.propTypes = {
- Component: PropTypes.oneOfType([
- PropTypes.node,
- PropTypes.func,
- PropTypes.object,
- ]).isRequired,
+ Component: PropTypes.oneOfType([PropTypes.node, PropTypes.func, PropTypes.object]).isRequired,
options: PropTypes.shape({
variables: PropTypes.shape({
itemId: PropTypes.string.isRequired,
diff --git a/packages/web-shared/providers/ModalProvider.js b/packages/web-shared/providers/ModalProvider.js
index 2ebb4693..5a0b236c 100644
--- a/packages/web-shared/providers/ModalProvider.js
+++ b/packages/web-shared/providers/ModalProvider.js
@@ -1,5 +1,7 @@
-import PropTypes from 'prop-types';
import React, { createContext, useContext, useReducer, useEffect } from 'react';
+
+import PropTypes from 'prop-types';
+
import { getContentFromURL } from '../utils';
const ModalStateContext = createContext();
diff --git a/packages/web-shared/providers/NavigationProvider.js b/packages/web-shared/providers/NavigationProvider.js
index d10eec03..9b3c8cc5 100644
--- a/packages/web-shared/providers/NavigationProvider.js
+++ b/packages/web-shared/providers/NavigationProvider.js
@@ -1,5 +1,7 @@
import React, { createContext, useContext } from 'react';
+
import { useSearchParams, useParams, useNavigate } from 'react-router-dom';
+
import { useApollosIdParam, useShouldUsePathRouter } from '../providers/AppProvider';
const NavigationContext = createContext({ id: null, navigate: () => {} });
@@ -24,6 +26,7 @@ const NavigationProvider = (props = {}) => {
nativeNavigate({
pathname: `/${type === 'content' ? 'ac' : 'af'}/${id}`,
});
+
// Assume that no params
} else {
nativeNavigate({
diff --git a/packages/web-shared/providers/SearchProvider.js b/packages/web-shared/providers/SearchProvider.js
index 1e762425..42115d97 100644
--- a/packages/web-shared/providers/SearchProvider.js
+++ b/packages/web-shared/providers/SearchProvider.js
@@ -1,4 +1,5 @@
import React, { createContext, useContext, useReducer } from 'react';
+
import PropTypes from 'prop-types';
const SearchStateContext = createContext();
diff --git a/packages/web-shared/providers/index.js b/packages/web-shared/providers/index.js
index cb1cdd04..854b9216 100644
--- a/packages/web-shared/providers/index.js
+++ b/packages/web-shared/providers/index.js
@@ -1,12 +1,13 @@
-import AppProvider from './AppProvider';
+import { createBrowserRouter, RouterProvider } from 'react-router-dom';
+
import AnalyticsProvider from './AnalyticsProvider';
+import AppProvider from './AppProvider';
import ContentFeedProvider from './ContentFeedProvider';
import ContentItemProvider from './ContentItemProvider';
import FeatureFeedProvider from './FeatureFeedProvider';
import ModalProvider from './ModalProvider';
-import SearchProvider from './SearchProvider';
import NavigationProvider from './NavigationProvider';
-import { createBrowserRouter, RouterProvider } from 'react-router-dom';
+import SearchProvider from './SearchProvider';
export {
AppProvider,
diff --git a/packages/web-shared/ui-kit/Avatar/Avatar.js b/packages/web-shared/ui-kit/Avatar/Avatar.js
index 6c48e9da..5d8953d1 100644
--- a/packages/web-shared/ui-kit/Avatar/Avatar.js
+++ b/packages/web-shared/ui-kit/Avatar/Avatar.js
@@ -1,6 +1,7 @@
import React from 'react';
-import { withTheme } from 'styled-components';
+
import { User } from '@phosphor-icons/react';
+import { withTheme } from 'styled-components';
import { Box, systemPropTypes } from '../../ui-kit';
diff --git a/packages/web-shared/ui-kit/Box/Box.js b/packages/web-shared/ui-kit/Box/Box.js
index 40a2706f..fd8651b6 100644
--- a/packages/web-shared/ui-kit/Box/Box.js
+++ b/packages/web-shared/ui-kit/Box/Box.js
@@ -1,8 +1,7 @@
import React from 'react';
-import { systemPropTypes } from '../_lib/system';
-
import Styled from './Box.styles';
+import { systemPropTypes } from '../_lib/system';
function Box(props = {}) {
return ;
diff --git a/packages/web-shared/ui-kit/Box/Box.styles.js b/packages/web-shared/ui-kit/Box/Box.styles.js
index 056cafbd..7c0682ac 100644
--- a/packages/web-shared/ui-kit/Box/Box.styles.js
+++ b/packages/web-shared/ui-kit/Box/Box.styles.js
@@ -1,6 +1,5 @@
-import styled, { css } from 'styled-components';
-import { withTheme } from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { css, withTheme } from 'styled-components';
import { system } from '../_lib/system';
diff --git a/packages/web-shared/ui-kit/Button/Button.js b/packages/web-shared/ui-kit/Button/Button.js
index a8698fcb..fa6780d1 100644
--- a/packages/web-shared/ui-kit/Button/Button.js
+++ b/packages/web-shared/ui-kit/Button/Button.js
@@ -1,8 +1,9 @@
import React from 'react';
+
import PropTypes from 'prop-types';
-import { systemPropTypes } from '../_lib/system';
import Styled from './Button.styles';
+import { systemPropTypes } from '../_lib/system';
// eslint-disable-next-line no-console
const Button = ({
diff --git a/packages/web-shared/ui-kit/Button/Button.styles.js b/packages/web-shared/ui-kit/Button/Button.styles.js
index 37c0a48d..90e5b48c 100644
--- a/packages/web-shared/ui-kit/Button/Button.styles.js
+++ b/packages/web-shared/ui-kit/Button/Button.styles.js
@@ -1,9 +1,9 @@
+import { themeGet } from '@styled-system/theme-get';
import Color from 'color';
import styled, { css, withTheme } from 'styled-components';
-import { themeGet } from '@styled-system/theme-get';
-import { TypeStyles } from '../Typography';
import { system } from '../_lib/system';
+import { TypeStyles } from '../Typography';
// Button
// --------------------------------------------------------
diff --git a/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.js b/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.js
index a8f68786..3c37e58e 100644
--- a/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.js
+++ b/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.js
@@ -1,10 +1,11 @@
import React, { useState, useEffect } from 'react';
-import { systemPropTypes } from '../_lib/system';
-import { Box } from '..';
-import Styled from './ButtonGroup.styles';
import { CaretLeft, CaretRight } from '@phosphor-icons/react';
+import Styled from './ButtonGroup.styles';
+import { Box } from '..';
+import { systemPropTypes } from '../_lib/system';
+
const ButtonGroup = ({ next, previous, goToSlide, ...rest }) => {
const {
carouselState: { currentSlide, slidesToShow, totalItems },
diff --git a/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.styles.js b/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.styles.js
index 9175527d..186e7d12 100644
--- a/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.styles.js
+++ b/packages/web-shared/ui-kit/ButtonGroup/ButtonGroup.styles.js
@@ -1,8 +1,8 @@
-import { withTheme } from 'styled-components';
-import styled, { css } from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { withTheme, css } from 'styled-components';
import { system } from '../_lib/system';
+
const ButtonGroup = withTheme(styled.div`
padding-top: 10px;
display: flex;
@@ -21,9 +21,7 @@ const buttonState = ({ theme, type, disabled }) => {
}
&:disabled {
opacity: 0.5;
- background: ${type === 'secondary'
- ? 'transparent'
- : theme.colors.fill.system1};
+ background: ${type === 'secondary' ? 'transparent' : theme.colors.fill.system1};
border: ${type === 'secondary' ? theme.colors.base.gray : 'transparent'};
cursor: not-allowed;
}
diff --git a/packages/web-shared/ui-kit/Card/Card.js b/packages/web-shared/ui-kit/Card/Card.js
index 88da639d..e1cfdc91 100644
--- a/packages/web-shared/ui-kit/Card/Card.js
+++ b/packages/web-shared/ui-kit/Card/Card.js
@@ -1,4 +1,5 @@
import React from 'react';
+
import { withTheme } from 'styled-components';
import { Box, systemPropTypes } from '../../ui-kit';
diff --git a/packages/web-shared/ui-kit/ContentCard/ContentCard.js b/packages/web-shared/ui-kit/ContentCard/ContentCard.js
index 62790dec..009758a6 100644
--- a/packages/web-shared/ui-kit/ContentCard/ContentCard.js
+++ b/packages/web-shared/ui-kit/ContentCard/ContentCard.js
@@ -1,11 +1,12 @@
import React from 'react';
-import { withTheme } from 'styled-components';
+
import { Check } from '@phosphor-icons/react';
+import { withTheme } from 'styled-components';
-import { SmallBodyText, Box, systemPropTypes, ProgressBar } from '../../ui-kit';
+import { BottomSlot, CompleteIndicator, Title, Summary, ChannelLabel } from './ContentCard.styles';
import { useVideoMediaProgress } from '../../hooks';
+import { SmallBodyText, Box, systemPropTypes, ProgressBar } from '../../ui-kit';
import { getPercentWatched } from '../../utils';
-import { BottomSlot, CompleteIndicator, Title, Summary, ChannelLabel } from './ContentCard.styles';
function ContentCard({
videoMedia,
diff --git a/packages/web-shared/ui-kit/ContentCard/ContentCard.styles.js b/packages/web-shared/ui-kit/ContentCard/ContentCard.styles.js
index 45b4e041..e05a7935 100644
--- a/packages/web-shared/ui-kit/ContentCard/ContentCard.styles.js
+++ b/packages/web-shared/ui-kit/ContentCard/ContentCard.styles.js
@@ -1,7 +1,5 @@
-import styled, { css } from 'styled-components';
-import { withTheme } from 'styled-components';
-
import { themeGet } from '@styled-system/theme-get';
+import styled, { css, withTheme } from 'styled-components';
import { system } from '../_lib/system';
import { rem } from '../_utils';
diff --git a/packages/web-shared/ui-kit/Icons/Dot.js b/packages/web-shared/ui-kit/Icons/Dot.js
index 49f2dcdb..41935fd3 100644
--- a/packages/web-shared/ui-kit/Icons/Dot.js
+++ b/packages/web-shared/ui-kit/Icons/Dot.js
@@ -1,10 +1,11 @@
import React from 'react';
+
+import { themeGet } from '@styled-system/theme-get';
import PropTypes from 'prop-types';
import { withTheme } from 'styled-components';
-import { themeGet } from '@styled-system/theme-get';
-import Box from '../Box';
import { systemPropTypes } from '../_lib/system';
+import Box from '../Box';
function Dot({ fill = 'white', size = 20, theme, ...rest }) {
const themeFillValue = themeGet(`colors.${fill}`)({ theme });
diff --git a/packages/web-shared/ui-kit/Input/Input.js b/packages/web-shared/ui-kit/Input/Input.js
index 0e1a10bf..07c13d43 100644
--- a/packages/web-shared/ui-kit/Input/Input.js
+++ b/packages/web-shared/ui-kit/Input/Input.js
@@ -1,7 +1,9 @@
import React, { useState, useRef, useEffect } from 'react';
+
import PropTypes from 'prop-types';
-import { Box, systemPropTypes, SystemText } from '..';
+
import Styled from './Input.styles';
+import { Box, systemPropTypes, SystemText } from '..';
const Input = ({ placeholder, value, handleOnChange, ...props }) => {
const textInputRef = useRef();
diff --git a/packages/web-shared/ui-kit/Input/Input.styles.js b/packages/web-shared/ui-kit/Input/Input.styles.js
index 2c2ce21e..c1f5d88e 100644
--- a/packages/web-shared/ui-kit/Input/Input.styles.js
+++ b/packages/web-shared/ui-kit/Input/Input.styles.js
@@ -1,10 +1,9 @@
-import { withTheme } from 'styled-components';
-import styled, { css } from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
import Color from 'color';
+import styled, { withTheme, css } from 'styled-components';
-import { TypeStyles } from '../Typography';
import { system } from '../_lib/system';
+import { TypeStyles } from '../Typography';
const labelColor = ({ theme, focused, hasValue, error }) => {
if (error) {
@@ -14,9 +13,7 @@ const labelColor = ({ theme, focused, hasValue, error }) => {
}
return css`
- color: ${focused || hasValue
- ? theme.colors.text.action
- : theme.colors.text.secondary};
+ color: ${focused || hasValue ? theme.colors.text.action : theme.colors.text.secondary};
`;
};
@@ -56,8 +53,7 @@ const Input = withTheme(styled.input`
${TypeStyles.LargeSystemText}
padding: ${themeGet('space.s')} 0 ${themeGet('space.xxs')} 0;
transition: all ${themeGet('timing.xl')} ease-out;
- placeholder-text-color: ${({ theme }) =>
- Color(theme.colors.text.secondary).alpha(0)};
+ placeholder-text-color: ${({ theme }) => Color(theme.colors.text.secondary).alpha(0)};
caret-color: ${themeGet('colors.base.primary')};
border-top: 0;
border-left: 0;
diff --git a/packages/web-shared/ui-kit/Layout/Layout.js b/packages/web-shared/ui-kit/Layout/Layout.js
index 62a5cec6..708154f5 100644
--- a/packages/web-shared/ui-kit/Layout/Layout.js
+++ b/packages/web-shared/ui-kit/Layout/Layout.js
@@ -1,8 +1,7 @@
import React from 'react';
-import { systemPropTypes } from '../_lib/system';
-
import Styled from './Layout.styles';
+import { systemPropTypes } from '../_lib/system';
function Layout(props = {}) {
return ;
diff --git a/packages/web-shared/ui-kit/Layout/Layout.styles.js b/packages/web-shared/ui-kit/Layout/Layout.styles.js
index 53dfed8c..bcac86ef 100644
--- a/packages/web-shared/ui-kit/Layout/Layout.styles.js
+++ b/packages/web-shared/ui-kit/Layout/Layout.styles.js
@@ -1,6 +1,5 @@
-import styled from 'styled-components';
-import { withTheme } from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { withTheme } from 'styled-components';
import { system } from '../_lib/system';
diff --git a/packages/web-shared/ui-kit/ListItem/ListItem.js b/packages/web-shared/ui-kit/ListItem/ListItem.js
index e40c0480..cdcf3e0f 100644
--- a/packages/web-shared/ui-kit/ListItem/ListItem.js
+++ b/packages/web-shared/ui-kit/ListItem/ListItem.js
@@ -1,10 +1,11 @@
import React from 'react';
-import { systemPropTypes } from '../_lib/system';
-import { Box } from '..';
+import { useNavigate } from 'react-router-dom';
+
import Styled from './ListItem.styles';
+import { Box } from '..';
import { getURLFromType } from '../../utils';
-import { useNavigate } from 'react-router-dom';
+import { systemPropTypes } from '../_lib/system';
function ListItem({ title, subtitle, leadingIcon, tailingIcon, node, onClick, ...props }) {
// If item has link, redirect to URL
@@ -44,7 +45,7 @@ function ListItem({ title, subtitle, leadingIcon, tailingIcon, node, onClick, ..
);
- //If leadingIcon is an image with uri, add frame to image. Otherwise, use whatever is passed in. If undefined, use default clip icon
+ // If leadingIcon is an image with uri, add frame to image. Otherwise, use whatever is passed in. If undefined, use default clip icon
const LeadingIcon = leadingIcon?.sources ? (
;
diff --git a/packages/web-shared/ui-kit/Longform/Longform.styles.js b/packages/web-shared/ui-kit/Longform/Longform.styles.js
index 101480fc..ef396354 100644
--- a/packages/web-shared/ui-kit/Longform/Longform.styles.js
+++ b/packages/web-shared/ui-kit/Longform/Longform.styles.js
@@ -1,9 +1,9 @@
-import styled from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled from 'styled-components';
import { system } from '../_lib/system';
+import { utils } from '../index';
import { TypeStyles } from '../Typography';
-import { utils } from "../index";
const Longform = styled.div`
${TypeStyles.BodyText};
diff --git a/packages/web-shared/ui-kit/MediaItem/LiveChip.js b/packages/web-shared/ui-kit/MediaItem/LiveChip.js
index aeca10d1..83516dbe 100644
--- a/packages/web-shared/ui-kit/MediaItem/LiveChip.js
+++ b/packages/web-shared/ui-kit/MediaItem/LiveChip.js
@@ -6,8 +6,8 @@
import React from 'react';
-import { SmallSystemText } from '../Typography';
import { LiveChipContainer } from './MediaItem.styles';
+import { SmallSystemText } from '../Typography';
export const ANIMATION_DURATION = 1300;
diff --git a/packages/web-shared/ui-kit/MediaItem/MediaItem.js b/packages/web-shared/ui-kit/MediaItem/MediaItem.js
index 82ce3d29..6755da23 100644
--- a/packages/web-shared/ui-kit/MediaItem/MediaItem.js
+++ b/packages/web-shared/ui-kit/MediaItem/MediaItem.js
@@ -1,15 +1,15 @@
import React from 'react';
-import { withTheme } from 'styled-components';
-import isNil from 'lodash/isNil';
+
import { Check } from '@phosphor-icons/react';
-import { unit } from '../../utils';
+import isNil from 'lodash/isNil';
+import { withTheme } from 'styled-components';
-import { BodyText, SmallBodyText, Box, H4, systemPropTypes, ProgressBar } from '../../ui-kit';
-import { useVideoMediaProgress } from '../../hooks';
-import { getPercentWatched } from '../../utils';
-import { Title, Image, BottomSlot, CompleteIndicator, Ellipsis } from './MediaItem.styles';
import LiveChip from './LiveChip';
-import { useLivestreamStatus } from '../../hooks';
+import { Title, Image, BottomSlot, CompleteIndicator, Ellipsis } from './MediaItem.styles';
+import { useVideoMediaProgress, useLivestreamStatus } from '../../hooks';
+import { BodyText, SmallBodyText, Box, H4, systemPropTypes, ProgressBar } from '../../ui-kit';
+import { unit, getPercentWatched } from '../../utils';
+
function MediaItem(props = {}) {
const { userProgress, loading: videoProgressLoading } = useVideoMediaProgress({
variables: { id: props.videoMedia?.id },
diff --git a/packages/web-shared/ui-kit/MediaItem/MediaItem.styles.js b/packages/web-shared/ui-kit/MediaItem/MediaItem.styles.js
index a28c5cbb..4e76d09d 100644
--- a/packages/web-shared/ui-kit/MediaItem/MediaItem.styles.js
+++ b/packages/web-shared/ui-kit/MediaItem/MediaItem.styles.js
@@ -1,11 +1,9 @@
-import styled, { css } from 'styled-components';
-import { withTheme } from 'styled-components';
-
import { themeGet } from '@styled-system/theme-get';
+import styled, { css, withTheme } from 'styled-components';
+import { unit } from '../../utils';
import { system } from '../_lib/system';
import { rem } from '../_utils';
-import { unit } from '../../utils';
import { TypeStyles } from '../Typography';
export const BottomSlot = withTheme(styled.div`
diff --git a/packages/web-shared/ui-kit/MediaItem/index.js b/packages/web-shared/ui-kit/MediaItem/index.js
index 67b28ac7..bfd6444c 100644
--- a/packages/web-shared/ui-kit/MediaItem/index.js
+++ b/packages/web-shared/ui-kit/MediaItem/index.js
@@ -1,4 +1,4 @@
-import { default as MediaItem } from './MediaItem';
import LiveChip from './LiveChip';
+import { default as MediaItem } from './MediaItem';
export { MediaItem as default, LiveChip };
diff --git a/packages/web-shared/ui-kit/PhospherIcon/PhospherIcon.js b/packages/web-shared/ui-kit/PhospherIcon/PhospherIcon.js
index 79e4b385..4405a377 100644
--- a/packages/web-shared/ui-kit/PhospherIcon/PhospherIcon.js
+++ b/packages/web-shared/ui-kit/PhospherIcon/PhospherIcon.js
@@ -1,12 +1,12 @@
-import flow from 'lodash/flow';
+import React from 'react';
+
+import * as Icon from '@phosphor-icons/react';
import camelCase from 'lodash/camelCase';
+import flow from 'lodash/flow';
import upperFirst from 'lodash/upperFirst';
-import React from 'react';
import { systemPropTypes } from '../_lib/system';
-import * as Icon from '@phosphor-icons/react';
-
const pascalCase = (string) => flow(camelCase, upperFirst)(string);
const PhospherIcon = ({ name, weight, size, color }) => {
diff --git a/packages/web-shared/ui-kit/ProgressBar/ProgressBar.js b/packages/web-shared/ui-kit/ProgressBar/ProgressBar.js
index e66b25c5..baa99c53 100644
--- a/packages/web-shared/ui-kit/ProgressBar/ProgressBar.js
+++ b/packages/web-shared/ui-kit/ProgressBar/ProgressBar.js
@@ -1,9 +1,9 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import { systemPropTypes } from '../_lib/system';
+import PropTypes from 'prop-types';
import { Container, Bar } from './ProgressBar.styles';
+import { systemPropTypes } from '../_lib/system';
function ProgressBar(props = {}) {
return (
diff --git a/packages/web-shared/ui-kit/ProgressBar/ProgressBar.styles.js b/packages/web-shared/ui-kit/ProgressBar/ProgressBar.styles.js
index cc88d4bf..588bb22b 100644
--- a/packages/web-shared/ui-kit/ProgressBar/ProgressBar.styles.js
+++ b/packages/web-shared/ui-kit/ProgressBar/ProgressBar.styles.js
@@ -1,6 +1,5 @@
-import { withTheme, css } from 'styled-components';
-import styled from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { withTheme, css } from 'styled-components';
import { system } from '../_lib/system';
diff --git a/packages/web-shared/ui-kit/ResourceCard/ResourceCard.js b/packages/web-shared/ui-kit/ResourceCard/ResourceCard.js
index 0ac9e163..4f6f1890 100644
--- a/packages/web-shared/ui-kit/ResourceCard/ResourceCard.js
+++ b/packages/web-shared/ui-kit/ResourceCard/ResourceCard.js
@@ -1,9 +1,10 @@
import React from 'react';
+
import { CaretRight } from '@phosphor-icons/react';
-import { systemPropTypes } from '../_lib/system';
-import { Box } from '..';
import Styled from './ResourceCard.styles';
+import { Box } from '..';
+import { systemPropTypes } from '../_lib/system';
function ResourceCard({ title, subtitle, leadingAsset, tailingIcon, onClick, ...props }) {
// Default tailing icon
@@ -43,7 +44,7 @@ function ResourceCard({ title, subtitle, leadingAsset, tailingIcon, onClick, ...
);
- //If leadingAsset is an image with uri, add frame to image. Otherwise, use whatever is passed in. If undefined, use default clip icon
+ // If leadingAsset is an image with uri, add frame to image. Otherwise, use whatever is passed in. If undefined, use default clip icon
const LeadingAsset = leadingAsset?.sources?.[0]?.uri ? (
{
const textInputRef = useRef();
@@ -59,11 +61,7 @@ const Select = ({ label = false, placeholder, options, ...props }) => {
))}
- {label ? (
- {placeholder}
- ) : (
- <>>
- )}
+ {label ? {placeholder} : <>>}
{props.error && (
diff --git a/packages/web-shared/ui-kit/Select/Select.styles.js b/packages/web-shared/ui-kit/Select/Select.styles.js
index 1cf86493..10bad6e8 100644
--- a/packages/web-shared/ui-kit/Select/Select.styles.js
+++ b/packages/web-shared/ui-kit/Select/Select.styles.js
@@ -1,10 +1,9 @@
-import { withTheme } from "styled-components";
-import styled, { css } from "styled-components";
-import { themeGet } from "@styled-system/theme-get";
-import Color from "color";
+import { themeGet } from '@styled-system/theme-get';
+import Color from 'color';
+import styled, { withTheme, css } from 'styled-components';
-import { TypeStyles } from "../Typography";
-import { system } from "../_lib/system";
+import { system } from '../_lib/system';
+import { TypeStyles } from '../Typography';
const labelColor = ({ theme, focused, hasValue, error }) => {
if (error) {
@@ -14,16 +13,14 @@ const labelColor = ({ theme, focused, hasValue, error }) => {
}
return css`
- color: ${focused || hasValue
- ? theme.colors.text.action
- : theme.colors.text.secondary};
+ color: ${focused || hasValue ? theme.colors.text.action : theme.colors.text.secondary};
`;
};
const labelStateStyle = ({ focused, hasValue }) => css`
${focused || hasValue ? TypeStyles.SystemText() : undefined};
top: 50%
- font-weight: ${focused ? 600 : "inherit"};
+ font-weight: ${focused ? 600 : 'inherit'};
`;
const Label = withTheme(styled.p`
@@ -32,7 +29,7 @@ const Label = withTheme(styled.p`
transform: translate(0, -14px); /* // TODO Fix brittle value. */
pointer-events: none;
- transition: all ${themeGet("timing.base")} ease-out;
+ transition: all ${themeGet('timing.base')} ease-out;
${labelStateStyle};
${labelColor};
`);
@@ -54,11 +51,10 @@ const textSelectStateStyle = ({ theme, error }) => {
const Select = withTheme(styled.select`
${TypeStyles.LargeSystemText}
- padding: ${themeGet("space.xs")} 0;
- transition: all ${themeGet("timing.xl")} ease-out;
- placeholder-text-color: ${({ theme }) =>
- Color(theme.colors.text.secondary).alpha(0)};
- caret-color: ${themeGet("colors.base.primary")};
+ padding: ${themeGet('space.xs')} 0;
+ transition: all ${themeGet('timing.xl')} ease-out;
+ placeholder-text-color: ${({ theme }) => Color(theme.colors.text.secondary).alpha(0)};
+ caret-color: ${themeGet('colors.base.primary')};
border-top: 0;
border-left: 0;
border-right: 0;
diff --git a/packages/web-shared/ui-kit/Select/index.js b/packages/web-shared/ui-kit/Select/index.js
index adb0c5ac..17d6bdad 100644
--- a/packages/web-shared/ui-kit/Select/index.js
+++ b/packages/web-shared/ui-kit/Select/index.js
@@ -1,3 +1,3 @@
-import Select from "./Select";
+import Select from './Select';
export default Select;
diff --git a/packages/web-shared/ui-kit/ShareButton/ShareButton.js b/packages/web-shared/ui-kit/ShareButton/ShareButton.js
index ed8e2b96..c5e0aff0 100644
--- a/packages/web-shared/ui-kit/ShareButton/ShareButton.js
+++ b/packages/web-shared/ui-kit/ShareButton/ShareButton.js
@@ -1,12 +1,13 @@
import React, { useState, useEffect } from 'react';
+
+import { Share } from '@phosphor-icons/react';
import PropTypes from 'prop-types';
-import { systemPropTypes } from '../_lib/system';
-import { Box, Button } from '../../ui-kit';
-import Styled from './ShareButton.styles';
-import options from './options';
import icons from './icons';
-import { Share } from '@phosphor-icons/react';
+import options from './options';
+import Styled from './ShareButton.styles';
+import { Box, Button } from '../../ui-kit';
+import { systemPropTypes } from '../_lib/system';
const ShareButton = (props = {}) => {
// Define state variable isMessageVisible with initial value false
diff --git a/packages/web-shared/ui-kit/ShareButton/ShareButton.styles.js b/packages/web-shared/ui-kit/ShareButton/ShareButton.styles.js
index 61bd9450..0b22002d 100644
--- a/packages/web-shared/ui-kit/ShareButton/ShareButton.styles.js
+++ b/packages/web-shared/ui-kit/ShareButton/ShareButton.styles.js
@@ -1,6 +1,5 @@
-import { withTheme } from 'styled-components';
-import styled, { css } from 'styled-components';
import { themeGet } from '@styled-system/theme-get';
+import styled, { withTheme, css } from 'styled-components';
import { system } from '../_lib/system';
@@ -13,8 +12,8 @@ const Option = withTheme(styled.div`
display: flex;
font-size: 16px;
align-items: center;
- padding: ${themeGet('space.xs')} ${themeGet('space.base')}
- ${themeGet('space.xs')} ${themeGet('space.xs')};
+ padding: ${themeGet('space.xs')} ${themeGet('space.base')} ${themeGet('space.xs')}
+ ${themeGet('space.xs')};
border-bottom: 1px solid ${themeGet('colors.neutral.gray3')};
&:hover {
color: ${themeGet('colors.base.secondary')};
@@ -27,8 +26,8 @@ const BorderlessOption = withTheme(styled.div`
display: flex;
font-size: 16px;
align-items: center;
- padding: ${themeGet('space.xs')} ${themeGet('space.base')}
- ${themeGet('space.xs')} ${themeGet('space.xs')};
+ padding: ${themeGet('space.xs')} ${themeGet('space.base')} ${themeGet('space.xs')}
+ ${themeGet('space.xs')};
&:hover {
color: ${themeGet('colors.base.secondary')};
}
@@ -63,9 +62,7 @@ const Wrapper = withTheme(styled.div`
top: -11px;
border-width: 0 11px 11px 11px;
border-style: solid;
- border-color: transparent transparent ${themeGet(
- 'colors.neutral.gray3'
- )}; transparent;
+ border-color: transparent transparent ${themeGet('colors.neutral.gray3')}; transparent;
}
::after {
@@ -75,9 +72,7 @@ const Wrapper = withTheme(styled.div`
top: -9px;
border-width: 0 10px 10px 10px;
border-style: solid;
- border-color: transparent transparent ${themeGet(
- 'colors.base.white'
- )} transparent;
+ border-color: transparent transparent ${themeGet('colors.base.white')} transparent;
}
border: 1px solid ${themeGet('colors.neutral.gray3')};
diff --git a/packages/web-shared/ui-kit/ShareButton/functions.js b/packages/web-shared/ui-kit/ShareButton/functions.js
index c28cee20..60d22fae 100644
--- a/packages/web-shared/ui-kit/ShareButton/functions.js
+++ b/packages/web-shared/ui-kit/ShareButton/functions.js
@@ -6,22 +6,16 @@ export function shareLinkByEmail(link) {
}
export function shareLinkOnFacebook(link) {
- const url = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(
- link
- )}`;
+ const url = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(link)}`;
window.open(url, '_blank', 'toolbar=0,location=0,menubar=0');
}
export function shareLinkOnTwitter(link) {
- const url = `https://twitter.com/intent/tweet?url=${encodeURIComponent(
- link
- )}`;
+ const url = `https://twitter.com/intent/tweet?url=${encodeURIComponent(link)}`;
window.open(url, '_blank', 'toolbar=0,location=0,menubar=0');
}
export function shareLinkOnLinkedIn(link) {
- const url = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(
- link
- )}`;
+ const url = `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(link)}`;
window.open(url, '_blank', 'toolbar=0,location=0,menubar=0');
}
diff --git a/packages/web-shared/ui-kit/ShareButton/icons.js b/packages/web-shared/ui-kit/ShareButton/icons.js
index 3f28094c..eaa5b1e1 100644
--- a/packages/web-shared/ui-kit/ShareButton/icons.js
+++ b/packages/web-shared/ui-kit/ShareButton/icons.js
@@ -2,12 +2,7 @@ import React from 'react';
const icons = {
email: (
-