Skip to content

Commit

Permalink
fix: admin api intergration #513
Browse files Browse the repository at this point in the history
completed api intergration in admin page
  • Loading branch information
jasurobo committed Nov 21, 2021
2 parents 0397e17 + e181309 commit 1a277a3
Show file tree
Hide file tree
Showing 42 changed files with 3,006 additions and 321 deletions.
2 changes: 1 addition & 1 deletion component/layout/BlogListing/Listing.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function Listing({
<ListingItem blog={blog} />
</div>
<div className={styles.wrapBtn}>
{blog.length !== blogCount && (
{blog?.length !== blogCount && (
<button className="btn btn--gray" onClick={handleLoadMore}>
<span className="btn__text">Load more</span>
</button>
Expand Down
6 changes: 3 additions & 3 deletions component/layout/BlogListing/ListingItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import moment from "moment";
import Tags from "./Tags";

export default function ListingItem(props) {
return props.blog.map((item, key) => (
return props.blog?.map((item, key) => (
<div className={styles.listing__item} key={key}>
<Fade>
<a href={`/${item.slug}`}>
Expand All @@ -27,8 +27,8 @@ export default function ListingItem(props) {
</a>
</Fade>
<div>
{item.tags.length > 0 ? (
<Tags _tags={item.tags} />
{item.tag?.length > 0 ? (
<Tags _tags={item.tag} />
) : (
<div className="tags h-9"></div>
)}
Expand Down
14 changes: 13 additions & 1 deletion component/layout/CourseList/CourseList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,19 @@ export default function CourseList({ courses }) {
imageHeight: 190,
title: "Learn JavaScript",
url: "/curriculum/javascript",
description: "Once the foundation is set, it’s time to step up your game and create the interactive side of your website. Kick things off with Javascript to learn the basic fundamentals of programming and achieve JS mastery.",
description:
"Once the foundation is set, it’s time to step up your game and create the interactive side of your website. Kick things off with Javascript to learn the basic fundamentals of programming and achieve JS mastery.",
linktext: "Learn more"
},
{
image: "/images/css3.svg",
alt: "ui-mastery",
imageWidth: 139,
imageHeight: 196,
title: "UI Mastery",
url: "/curriculum/ui-mastery",
description:
"Kick things off with Javascript to learn the basic fundamentals of programming and achieve JS mastery. Add life, colours and style to the contents of the website you created by practising alongside the best way to learn CSS. This guide is suitable for anyone eager to pave a path towards maintaining complex web pages with ease.",
linktext: "Learn more"
},
{
Expand Down
26 changes: 18 additions & 8 deletions component/myblogs/WriteNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default function WriteNav({
notify(err?.response?.data?.message ?? err?.message, 'error');
}
}
console.log(currentPost, 'hola');
/**
* posts tags to db and sets state for user tags
* @param e react select handle change event
Expand All @@ -105,7 +104,7 @@ export default function WriteNav({
const newTag = e
.filter((tag) => {
if (tag.__isNew__ === true) {
console.log(tag);
// console.log(tag);
return tag;
}
})
Expand Down Expand Up @@ -344,12 +343,23 @@ export default function WriteNav({
<span className="text-gray-500 ml-1">{"/ Edit"}</span>
</div>
<div className="items-center py-3 md:flex hidden">
<div
onClick={handlePublish}
className="bg-green-710 hover:bg-white border border-green-710 text-white hover-green-pink-710 flex items-center text-sm font-semibold px-4 py-2 mr-3 rounded-sm cursor-pointer duration-700"
>
<p>Publish</p>
</div>
<ModalConfirm
trigger={
<div

className="bg-green-710 hover:bg-white border border-green-710 text-white hover-green-pink-710 flex items-center text-sm font-semibold px-4 py-2 mr-3 rounded-sm cursor-pointer duration-700"
>
<p>Publish</p>
</div>
}
handleSubmit={handlePublish}
purpose={"publish"}
buttonColor={"green"}
heading={"Are you sure"}
text=" you want to publish this post?"
secondaryText="This cannot be undone"
/>

<div
onClick={saveToDraft}
className="bg-black hover:bg-white border border-black text-white hover:text-black flex items-center text-sm font-semibold px-4 py-2 mr-3 rounded-sm cursor-pointer duration-700"
Expand Down
2 changes: 1 addition & 1 deletion component/profile/SkillSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function SkillSet({ userData }) {
className={`px-5 h-7 rounded flex justify-center items-center mr-2 text-sm mb-2 font-semibold ${Profilestyles?.skillCard}`}
key={skill}
>
{skill.name.toUpperCase()}
{skill?.name?.toUpperCase()}
</div>
)
)}
Expand Down
8 changes: 5 additions & 3 deletions config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ const loginUrl = `${apiVerUrl}/signin`;
const signUpUrl = `${apiVerUrl}/user`;
const userUrl = `${apiVerUrl}/user`;
const usersUrl = `${apiVerUrl}/users`;
const adminUrl = `${apiVerUrl}/admin`;
const eventUrl = `${apiVerUrl}/admin/event`;
const adminUrl = "api/admin";
const tagUrl = `${apiVerUrl}/tags`;
const postTagUrl = `${apiVerUrl}/post-tag`;
const postTagsUrl = `${apiVerUrl}/post-tags`;
const postSkillUrl = `${apiVerUrl}/user-tag`;
const postSkillsUrl = `${apiVerUrl}/user-tags`;
const CreateTagUrl = `${apiVerUrl}/tag`;
const skillUrl = "api/skills";
const searchUrl = "api/search";
Expand All @@ -37,14 +38,15 @@ const logoutUrl = `${apiVerUrl}/logout`;
const configVars = {
baseUrl,
postTagsUrl,
postSkillsUrl,
postSkillUrl,
postTagUrl,
postUser,
loginUrl,
signUpUrl,
clientUrl,
s3Url,
authUrl,
eventUrl,
enrolUrl,
postUrl,
postBySlug,
Expand Down
16 changes: 8 additions & 8 deletions courses/javascript/datatypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ testCase: [
]
---

A value in JavaScript is always of a certain type. It can be a string or a number or of any other type.
A value in JavaScript is always of a certain type. It can be a `string` or a `number` or of any other type.

There are **eight basic data types** in JavaScript. A varaible can store any such value. It can store a string at one moment and then store a number later.

Expand All @@ -39,7 +39,7 @@ Programming languages that allow such things, such as JavaScript, are called **

## Number

The _number_ type represents both integer and floating point numbers.
The _`number`_ type represents both integer and floating point numbers.

```javascript
let n = 123;
Expand All @@ -48,18 +48,18 @@ n = 12.345;

## String

The _string_ in JavaScript must be surrounded by quotes. In JavaScript, there are 3 types of quotes. Double quotes "" , Single quotes '' and Backticks ``. Double and single quotes are “simple” quotes. There’s practically no difference between them in JavaScript. Backticks are “extended functionality” quotes. They allow us to embed variables and expressions into a string by wrapping them in ${…}, for example:
The _`string`_ in JavaScript must be surrounded by quotes. In JavaScript, there are 3 types of quotes. Double quotes "" , Single quotes '' and Backticks \`\`\. Double and single quotes are “simple” quotes. There’s practically no difference between them in JavaScript. Backticks are “extended functionality” quotes. They allow us to embed variables and expressions into a string by wrapping them in `${…}` , for example:

```javascript
let str = "Hello"; // Hello
let str2 = "Single quotes are ok too"; // Single quotes are ok too
let phrase = `can embed another ${str}`; // can embed another Hello
let result = `the result is ${1 + 2}`; // the result is 3
let result = `the result is ${1 + 2}`; // the result is 3
```

## Boolean

The boolean type has only two values: true and false. This type is commonly used to store yes/no values: true means “yes, correct”, and false means “no, incorrect”.
The boolean type has only two values: `true` and `false`. This type is commonly used to store yes/no values: `true` means “yes, correct”, and `false` means “no, incorrect”.

```javascript
let nameFieldChecked = true; // yes, name field is checked
Expand All @@ -70,8 +70,8 @@ let ageFieldChecked = false; // no, age field is not checked

## Complete the tasks below:

- Create a variable num of type let and value 101
- Create a variable `num` of type `let` and value 101

- Create variable str of type let and value "hello"
- Create variable `str` of type `let` and value "hello"

- Create a variable flag of type let and value true
- Create a variable `flag` of type `let` and value `true`
2 changes: 1 addition & 1 deletion courses/javascript/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function printText(text1, text2) {
}
let str1 = "Hello";
let str2 = "world!";
printText(str1, str2); // Hello world!
printText(str1, str2); // Hello world!
```

From the above code snippet a function consist of:
Expand Down
24 changes: 12 additions & 12 deletions courses/javascript/logical-operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ testCase: [
]
---

There are four logical operators in JavaScript: || (OR), && (AND), ! (NOT), ?? (Nullish Coalescing).
There are four logical operators in JavaScript: `||` (OR), `&&` (AND), `!` (NOT), `??` (Nullish Coalescing).
Although they are called “logical”, they can be applied to values of any type, not only boolean. Their result can also be of any type.

## OR ||

The “OR” operator is represented with two vertical line symbols || :
The “OR” operator is represented with two vertical line symbols `||` :

```javascript
result = a || b;
```

In classical programming, the logical OR is meant to manipulate boolean values only. If any of its arguments are true, it returns true, otherwise it returns false.
In classical programming, the logical OR is meant to manipulate boolean values only. If any of its arguments are `true`, it returns `true`, otherwise it returns `false`.
There are four possible logical combinations:

```javascript
Expand All @@ -53,17 +53,17 @@ console.log(true || false); // true
console.log(false || false); // false
```

As we can see, the result is always true except for the case when both operands are false.
As we can see, the result is always `true` except for the case when both operands are `false`.

## AND &&

The AND operator is represented with two ampersands &&:
The AND operator is represented with two ampersands `&&`:

```javascript
result = a && b;
```

In classical programming, AND returns true if both operands are truthy and false otherwise:
In classical programming, AND returns `true` if both operands are truthy and `false` otherwise:

```javascript
console.log(true && true); // true
Expand All @@ -85,15 +85,15 @@ if (hour == 12 && minute == 30) {

## ! NOT

The boolean NOT operator is represented with an exclamation sign !.
The boolean NOT operator is represented with an exclamation sign `!`.

```javascript
result = !value;
```

The operator accepts a single argument and does the following:

- Converts the operand to boolean type: true/false.
- Converts the operand to boolean type: `true`/`false`.
- Returns the inverse value.

### Example:
Expand All @@ -107,10 +107,10 @@ console.log(!0); // true

## Complete the tasks below:

- Create two variables a and b and assign values true and false respectively.
- Create two variables `a` and `b` and assign values `true` and `false` respectively.

- Perform an AND operation on a and b and assign the value to a variable result.
- Perform an AND operation on `a`and `b` and assign the value to a variable `result`.

- Perform an OR operation on a and b and assign the value to result.
- Perform an OR operation on `a` and `b` and assign the value to `result`.

- Perform a NOT operation on a and assign the value to result.
- Perform a NOT operation on `a` and assign the value to `result`.
18 changes: 9 additions & 9 deletions courses/javascript/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ To create a variable in JavaScript, we can use `var`, `let` and `const`.

It's easy to get confused about the difference between `var`, `let` and `const`. No worries fellow developers, we got your back.

It is important we understand the difference betweeen various scopes in `js`.
It is important we understand the difference betweeen various scopes in js.

## Scopes

Expand Down Expand Up @@ -133,7 +133,7 @@ function letTest() {
const varname1 = "some value";
```

Variables declared using `const` is just like let. The only difference is that constants cannot be re-assigned.
Variables declared using `const` is just like `let`. The only difference is that constants cannot be re-assigned.

`const` cannot be redeclared in the same block too. But can be redeclared inside sub-blocks.

Expand All @@ -154,16 +154,16 @@ console.log(a); // 'something'

## Complete the tasks below:

- Create a variable named a using const and initialize it with a value of 9
- Create a variable named `a`, using `const` and initialize it with a value of 9

- Create b variable using let with variable name a.
- Create a variable using `let`, with variable name `b`.

- Assign the variable b a value of 5.
- Assign the variable `b`, a value of 5.

- Then change the value of b to "Message".
- Then change the value of `b` to "Message".

- Create c variable using let with variable name a.
- Create a variable using `let` with variable name `c`.

- Assign the variable c a value of 7.
- Assign the variable `c`, a value of 7.

- Then change the value of c to "Something".
- Then change the value of `c` to "Something".
Loading

0 comments on commit 1a277a3

Please sign in to comment.