@mjhls/mjh-framework 1.0.675 → 1.0.678

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.675
2
+ # mjh-framework v. 1.0.678
3
3
 
4
4
  > Foundation Framework
5
5
 
@@ -125,11 +125,11 @@ var HamMagazine = function HamMagazine(props) {
125
125
  if (resolution === 0) {
126
126
  setResolution(window.innerWidth);
127
127
  } else {
128
- if (window.innerWidth < 768 && resolution >= 768) {
128
+ if (window.innerWidth < 768 && resolution >= 768 && isDesktop) {
129
129
  console.log('Detected Mobile Resolution');
130
130
  window.location.reload();
131
131
  // Updating the condition to reload the page on resize in desktop view
132
- } else if (window.innerWidth >= 768) {
132
+ } else if (window.innerWidth >= 768 && !isDesktop) {
133
133
  console.log('Detected Tablet/Desktop Resolution');
134
134
  window.location.reload();
135
135
  }
@@ -127,11 +127,11 @@ var NavMagazine = function NavMagazine(props) {
127
127
  if (resolution === 0) {
128
128
  setResolution(window.innerWidth);
129
129
  } else {
130
- if (window.innerWidth < 768 && resolution >= 768) {
130
+ if (window.innerWidth < 768 && resolution >= 768 && isDesktop) {
131
131
  console.log('Detected Mobile Resolution');
132
132
  window.location.reload();
133
133
  // Updating the condition to reload the page on resize in desktop view
134
- } else if (window.innerWidth >= 768) {
134
+ } else if (window.innerWidth >= 768 && !isDesktop) {
135
135
  console.log('Detected Tablet/Desktop Resolution');
136
136
  window.location.reload();
137
137
  }
@@ -77,7 +77,14 @@ var NavNative = function NavNative(props) {
77
77
  screenWidth = _useState6[0],
78
78
  setScreenWidth = _useState6[1];
79
79
 
80
+ var _useState7 = React.useState(true),
81
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
82
+ isDesktop = _useState8[0],
83
+ setIsDesktop = _useState8[1];
84
+
80
85
  React.useEffect(function () {
86
+ // Check for desktop or mobile device
87
+ if (window && window.innerWidth < 1200) setIsDesktop(false);
81
88
  // Initial screenwidth on refresh or on load
82
89
  setScreenWidth(parseInt(window.innerWidth));
83
90
  // Initial User agent setup on refresh or on load
@@ -96,11 +103,11 @@ var NavNative = function NavNative(props) {
96
103
  if (resolution === 0) {
97
104
  setResolution(window.innerWidth);
98
105
  } else {
99
- if (window.innerWidth < 768 && resolution >= 768) {
106
+ if (window.innerWidth < 768 && resolution >= 768 && isDesktop) {
100
107
  console.log('Detected Mobile Resolution');
101
108
  window.location.reload();
102
109
  // Updating the condition to reload the page on resize in desktop view
103
- } else if (window.innerWidth >= 768) {
110
+ } else if (window.innerWidth >= 768 && !isDesktop) {
104
111
  console.log('Detected Tablet/Desktop Resolution');
105
112
  window.location.reload();
106
113
  }
@@ -122,10 +129,10 @@ var NavNative = function NavNative(props) {
122
129
 
123
130
  // Search Term
124
131
 
125
- var _useState7 = React.useState(''),
126
- _useState8 = slicedToArray._slicedToArray(_useState7, 2),
127
- searchKey = _useState8[0],
128
- setSearchKey = _useState8[1];
132
+ var _useState9 = React.useState(''),
133
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
134
+ searchKey = _useState10[0],
135
+ setSearchKey = _useState10[1];
129
136
 
130
137
  // Search function
131
138
 
@@ -10,13 +10,13 @@ var getQuery = function getQuery(type) {
10
10
 
11
11
  switch (type) {
12
12
  case 'related':
13
- return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && published <= now()\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
13
+ return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
14
14
  case 'article':
15
15
  return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n medias[]{\n ...,\n upload_doc {\n _type,\n asset-> \n } \n },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n volume,\n \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
16
16
  case 'publication':
17
17
  return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issues\': *[_type == \'publication\'\n && is_visible\n && references(^._id)\n && defined(identifier)] {\n ...,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
18
18
  case 'issue':
19
- return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n && published <= $currentDate\n && passwordLock != true\n && references(^._id)] | order(published desc) {\n ...,\n authorMapping[0]->,\n contentCategory->,\n issueSection-> {\n name\n }\n }\n }\n }';
19
+ return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock != true\n && references(^._id)] | order(published desc) {\n ...,\n authorMapping[0]->,\n contentCategory->,\n issueSection-> {\n name\n }\n }\n }\n }';
20
20
  case 'externalResources':
21
21
  return '{\n \'archived\': *[_type == "external" && archived && isVisible ' + conditions + '] | order(displayDate desc),\n \'recent\': *[_type == "external" && archived != true && isVisible ' + conditions + '] | order(displayDate asc)\n }';
22
22
  }
@@ -118,11 +118,11 @@ var HamMagazine = function HamMagazine(props) {
118
118
  if (resolution === 0) {
119
119
  setResolution(window.innerWidth);
120
120
  } else {
121
- if (window.innerWidth < 768 && resolution >= 768) {
121
+ if (window.innerWidth < 768 && resolution >= 768 && isDesktop) {
122
122
  console.log('Detected Mobile Resolution');
123
123
  window.location.reload();
124
124
  // Updating the condition to reload the page on resize in desktop view
125
- } else if (window.innerWidth >= 768) {
125
+ } else if (window.innerWidth >= 768 && !isDesktop) {
126
126
  console.log('Detected Tablet/Desktop Resolution');
127
127
  window.location.reload();
128
128
  }
@@ -120,11 +120,11 @@ var NavMagazine = function NavMagazine(props) {
120
120
  if (resolution === 0) {
121
121
  setResolution(window.innerWidth);
122
122
  } else {
123
- if (window.innerWidth < 768 && resolution >= 768) {
123
+ if (window.innerWidth < 768 && resolution >= 768 && isDesktop) {
124
124
  console.log('Detected Mobile Resolution');
125
125
  window.location.reload();
126
126
  // Updating the condition to reload the page on resize in desktop view
127
- } else if (window.innerWidth >= 768) {
127
+ } else if (window.innerWidth >= 768 && !isDesktop) {
128
128
  console.log('Detected Tablet/Desktop Resolution');
129
129
  window.location.reload();
130
130
  }
@@ -70,7 +70,14 @@ var NavNative = function NavNative(props) {
70
70
  screenWidth = _useState6[0],
71
71
  setScreenWidth = _useState6[1];
72
72
 
73
+ var _useState7 = useState(true),
74
+ _useState8 = _slicedToArray(_useState7, 2),
75
+ isDesktop = _useState8[0],
76
+ setIsDesktop = _useState8[1];
77
+
73
78
  useEffect(function () {
79
+ // Check for desktop or mobile device
80
+ if (window && window.innerWidth < 1200) setIsDesktop(false);
74
81
  // Initial screenwidth on refresh or on load
75
82
  setScreenWidth(parseInt(window.innerWidth));
76
83
  // Initial User agent setup on refresh or on load
@@ -89,11 +96,11 @@ var NavNative = function NavNative(props) {
89
96
  if (resolution === 0) {
90
97
  setResolution(window.innerWidth);
91
98
  } else {
92
- if (window.innerWidth < 768 && resolution >= 768) {
99
+ if (window.innerWidth < 768 && resolution >= 768 && isDesktop) {
93
100
  console.log('Detected Mobile Resolution');
94
101
  window.location.reload();
95
102
  // Updating the condition to reload the page on resize in desktop view
96
- } else if (window.innerWidth >= 768) {
103
+ } else if (window.innerWidth >= 768 && !isDesktop) {
97
104
  console.log('Detected Tablet/Desktop Resolution');
98
105
  window.location.reload();
99
106
  }
@@ -115,10 +122,10 @@ var NavNative = function NavNative(props) {
115
122
 
116
123
  // Search Term
117
124
 
118
- var _useState7 = useState(''),
119
- _useState8 = _slicedToArray(_useState7, 2),
120
- searchKey = _useState8[0],
121
- setSearchKey = _useState8[1];
125
+ var _useState9 = useState(''),
126
+ _useState10 = _slicedToArray(_useState9, 2),
127
+ searchKey = _useState10[0],
128
+ setSearchKey = _useState10[1];
122
129
 
123
130
  // Search function
124
131
 
@@ -8,13 +8,13 @@ var getQuery = function getQuery(type) {
8
8
 
9
9
  switch (type) {
10
10
  case 'related':
11
- return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && published <= now()\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
11
+ return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
12
12
  case 'article':
13
13
  return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n medias[]{\n ...,\n upload_doc {\n _type,\n asset-> \n } \n },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n volume,\n \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
14
14
  case 'publication':
15
15
  return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issues\': *[_type == \'publication\'\n && is_visible\n && references(^._id)\n && defined(identifier)] {\n ...,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
16
16
  case 'issue':
17
- return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n && published <= $currentDate\n && passwordLock != true\n && references(^._id)] | order(published desc) {\n ...,\n authorMapping[0]->,\n contentCategory->,\n issueSection-> {\n name\n }\n }\n }\n }';
17
+ return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock != true\n && references(^._id)] | order(published desc) {\n ...,\n authorMapping[0]->,\n contentCategory->,\n issueSection-> {\n name\n }\n }\n }\n }';
18
18
  case 'externalResources':
19
19
  return '{\n \'archived\': *[_type == "external" && archived && isVisible ' + conditions + '] | order(displayDate desc),\n \'recent\': *[_type == "external" && archived != true && isVisible ' + conditions + '] | order(displayDate asc)\n }';
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.675",
3
+ "version": "1.0.678",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",