Skip to content

Commit

Permalink
Merge branch 'learningequality:develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
GarvitSinghal47 authored Jan 11, 2024
2 parents 9f85c90 + ac8393c commit b5e679e
Show file tree
Hide file tree
Showing 407 changed files with 4,459 additions and 4,824 deletions.
62 changes: 34 additions & 28 deletions .github/workflows/add_contributor.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,56 @@
name: Add Contributor to AUTHORS.md
name: Add new contributor to AUTHORS.md
on:
pull_request:
types:
- opened
- synchronize
types: [opened]

jobs:
add_contributor:
check_contributor_exists:
runs-on: ubuntu-latest

outputs:
is_contributor_in_file: ${{ steps.check_contributor_step.outputs.exists }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: .

- name: Check if contributor already exists
id: check_contributor
id: check_contributor_step
run: |
exists=$(grep -c -F "$GITHUB_ACTOR" AUTHORS.md || true)
exists=$(grep -c -F "${{ github.event.pull_request.user.login }}" AUTHORS.md || true)
if [[ $exists -gt 0 ]]; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "exists=true" >> "$GITHUB_OUTPUT"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Get contributor's full name
id: get_full_name
if: steps.check_contributor.outputs.exists == 'false'
add_contributor:
runs-on: ubuntu-latest
needs: check_contributor_exists

if: needs.check_contributor_exists.outputs.is_contributor_in_file == 'false'

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Get contributor's full name and append to AUTHORS.md file
run: |
username=$GITHUB_ACTOR
access_token=$GITHUB_TOKEN
full_name=$(curl -s -H "Authorization: token $access_token" "https://api.github.com/users/$username" | jq -r '.name')
username=${{ github.event.pull_request.user.login }}
full_name=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/users/$username" | jq -r '.name')
if [[ "$full_name" == "" || "$full_name" == "null" ]]; then
full_name='-'
fi
echo "full_name=$full_name" >> $GITHUB_OUTPUT
echo "| $full_name | $username |" >> AUTHORS.md
- name: Append contributor to AUTHORS.md
id: append_contributor
if: steps.check_contributor.outputs.exists == 'false'
- name: Commit and push changes to the contributor's PR branch
run: |
full_name=${{ steps.get_full_name.outputs.full_name }}
echo "| $full_name | $GITHUB_ACTOR |" >> AUTHORS.md
- name: Commit and push changes to branch
id: commit_changes
if: steps.check_contributor.outputs.exists == 'false'
uses: pre-commit-ci/[email protected]
with:
msg: Add ${{ env.GITHUB_ACTOR }} to AUTHORS.md
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add AUTHORS.md
git commit -m "Add ${{ github.event.pull_request.user.login }} to AUTHORS.md"
git push origin ${{ github.head_ref }}
2 changes: 1 addition & 1 deletion .github/workflows/build_whl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check_licenses.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Cache Node.js modules
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/yarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
node-version: '18.x'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
Expand Down
1 change: 0 additions & 1 deletion AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ If you have contributed to Kolibri, feel free to add your name and Github accoun
| Shanavas M | shanavas786 |
| - | shivangtripathi |
| Udith Prabhu | udithprabhu |
| Vivek Agrawal | vkWeb |
| Whitney Zhu | whitzhu |
| Carol Willing | willingc |
| Yash Jipkate | YashJipkate |
Expand Down
4 changes: 2 additions & 2 deletions docker/base.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:jammy

ENV NODE_VERSION=16.20.0
ENV NODE_VERSION=18.19.0

# install required packages
RUN apt-get update && \
Expand All @@ -22,7 +22,7 @@ RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources
# install nodejs and yarn
RUN apt-get update && \
ARCH=$(dpkg --print-architecture) && \
curl -sSO https://deb.nodesource.com/node_16.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
curl -sSO https://deb.nodesource.com/node_18.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
dpkg -i ./nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
rm nodejs_$NODE_VERSION-1nodesource1_$ARCH.deb && \
apt-get install yarn
Expand Down
4 changes: 2 additions & 2 deletions docker/build_whl.dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ubuntu:bionic

ENV NODE_VERSION=16.20.0
ENV NODE_VERSION=18.19.0

# install required packages
RUN apt-get update && \
Expand All @@ -24,7 +24,7 @@ RUN (curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -) && \

# install nodejs and yarn
RUN apt-get update && \
curl -sSO https://deb.nodesource.com/node_16.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
curl -sSO https://deb.nodesource.com/node_18.x/pool/main/n/nodejs/nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
dpkg -i ./nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
rm nodejs_$NODE_VERSION-1nodesource1_amd64.deb && \
apt-get install yarn
Expand Down
4 changes: 2 additions & 2 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ Note that the ``--upgrade`` flags above can usually be omitted to speed up the p
Install Node.js, Yarn and other dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Install `Node.js <https://nodejs.org/en/download/>`__ (version 16.x is required)
#. Install `Node.js <https://nodejs.org/en/download/>`__ (version 18.x is required)
#. Install `Yarn <https://yarnpkg.com/>`__
#. Install non-python project-specific dependencies

Expand All @@ -170,7 +170,7 @@ The Python project-specific dependencies installed above will install ``nodeenv`
# If you are setting up the release-v0.15.x branch or earlier:
nodeenv -p --node=10.17.0
# If you are setting up the develop branch:
nodeenv -p --node=16.20.0
nodeenv -p --node=18.19.0
npm install -g yarn
# other required project dependencies
Expand Down
8 changes: 4 additions & 4 deletions docs/howtos/nodeenv.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ $ nodeenv -l
but this lists out everything. Alternatively, here's a one line bash function that can be used to determine that version:
```bash
$ function latest-node() { curl -s "https://nodejs.org/dist/latest-v$1.x/" | egrep -m 1 -o "$1\.[0-9]+\.[0-9]+" | head -1; }
$ latest-node 16
16.16.0
$ latest-node 18
18.19.0
```

Once you've determined the version, you can install it:
```bash
$ nodeenv --python-virtualenv --node 16.16.0
* Install prebuilt node (16.16.0) ..... done.
$ nodeenv --python-virtualenv --node 18.19.0
* Install prebuilt node (18.19.0) ..... done.
* Appending data to /home/bjester/Projects/learningequality/kolibri/venv/bin/activate
* Appending data to /home/bjester/Projects/learningequality/kolibri/venv/bin/activate.fish
```
Expand Down
1 change: 1 addition & 0 deletions kolibri/core/assets/src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const ERROR_CONSTANTS = {
ALREADY_REGISTERED_FOR_COMMUNITY: 'ALREADY_REGISTERED_FOR_COMMUNITY',
// 401 error constants
INVALID_CREDENTIALS: 'INVALID_CREDENTIALS',
INVALID_USERNAME: 'INVALID_USERNAME',
// 404 error constants
NOT_FOUND: 'NOT_FOUND',
INVALID_KDP_REGISTRATION_TOKEN: 'INVALID_KDP_REGISTRATION_TOKEN',
Expand Down
1 change: 0 additions & 1 deletion kolibri/core/assets/src/views/BottomAppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
}
.bottom-sm {
height: auto;
min-height: 72px;
}
Expand Down
86 changes: 65 additions & 21 deletions kolibri/core/assets/src/views/CorePage/AppBarPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@
here or in router, but somewhere -->
<div class="main">
<ScrollingHeader :scrollPosition="0">
<AppBar
ref="appBar"
class="app-bar"
:title="title"
@toggleSideNav="navShown = !navShown"
@showLanguageModal="languageModalShown = true"
>
<template #sub-nav>
<slot name="subNav"></slot>
</template>
</AppBar>
<transition mode="out-in">
<AppBar
v-if="showAppBarsOnScroll"
ref="appBar"
class="app-bar"
:title="title"
@toggleSideNav="navShown = !navShown"
@showLanguageModal="languageModalShown = true"
>
<template #sub-nav>
<slot name="subNav"></slot>
</template>
</AppBar>
</transition>
<KLinearLoader
v-if="isLoading"
type="indeterminate"
Expand All @@ -32,21 +35,22 @@
<slot></slot>
</div>

<SideNav
ref="sideNav"
:navShown="navShown"
@toggleSideNav="navShown = !navShown"
@shouldFocusFirstEl="findFirstEl()"
/>
<transition mode="out-in">
<SideNav
v-if="showAppBarsOnScroll"
ref="sideNav"
:navShown="navShown"
@toggleSideNav="navShown = !navShown"
@shouldFocusFirstEl="findFirstEl()"
/>
</transition>
<LanguageSwitcherModal
v-if="languageModalShown"
ref="languageSwitcherModal"
:style="{ color: $themeTokens.text }"
@cancel="languageModalShown = false"
/>

<MeteredConnectionNotificationModal />

</div>

</template>
Expand All @@ -55,13 +59,14 @@
<script>
import { mapGetters } from 'vuex';
import { throttle } from 'frame-throttle';
import LanguageSwitcherModal from 'kolibri.coreVue.components.LanguageSwitcherModal';
import ScrollingHeader from 'kolibri.coreVue.components.ScrollingHeader';
import useKResponsiveWindow from 'kolibri.coreVue.composables.useKResponsiveWindow';
import SideNav from 'kolibri.coreVue.components.SideNav';
import { LearnerDeviceStatus } from 'kolibri.coreVue.vuex.constants';
import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import MeteredConnectionNotificationModal from 'kolibri-common/components/MeteredConnectionNotificationModal';
import { isTouchDevice } from 'kolibri.utils.browserInfo';
import AppBar from '../AppBar';
import StorageNotification from '../StorageNotification';
import useUserSyncStatus from '../../composables/useUserSyncStatus';
Expand All @@ -70,7 +75,6 @@
name: 'AppBarPage',
components: {
AppBar,
MeteredConnectionNotificationModal,
LanguageSwitcherModal,
ScrollingHeader,
SideNav,
Expand Down Expand Up @@ -108,10 +112,16 @@
appBarHeight: 0,
languageModalShown: false,
navShown: false,
lastScrollTop: 0,
hideAppBars: true,
throttledHandleScroll: null,
};
},
computed: {
...mapGetters(['isAppContext', 'isPageLoading']),
isAppContextAndTouchDevice() {
return this.isAppContext && isTouchDevice;
},
isLoading() {
return this.isPageLoading || this.loading;
},
Expand Down Expand Up @@ -139,6 +149,13 @@
showStorageNotification() {
return this.userDeviceStatus === LearnerDeviceStatus.INSUFFICIENT_STORAGE;
},
showAppBarsOnScroll() {
let show = true;
if (this.isAppContextAndTouchDevice) {
show = this.hideAppBars;
}
return show;
},
},
watch: {
windowBreakpoint() {
Expand All @@ -150,13 +167,40 @@
this.$nextTick(() => {
this.appBarHeight = this.$refs.appBar.$el.scrollHeight || 0;
});
this.addScrollListener();
},
beforeUnmount() {
this.removeScrollListener();
},
methods: {
addScrollListener() {
if (this.isAppContextAndTouchDevice) {
this.throttledHandleScroll = throttle(this.handleScroll);
window.addEventListener('scroll', this.throttledHandleScroll);
}
},
findFirstEl() {
this.$nextTick(() => {
this.$refs.sideNav.focusFirstEl();
});
},
handleScroll() {
const scrollTop = window.scrollY;
//Is user scrolling up?
if (scrollTop > this.lastScrollTop) {
this.hideAppBars = false;
} else {
this.hideAppBars = true;
}
this.lastScrollTop = scrollTop;
},
removeScrollListener() {
if (this.isAppContextAndTouchDevice) {
window.removeEventListener('scroll', this.throttledHandleScroll);
this.throttledHandleScroll.cancel();
this.throttledHandleScroll = null;
}
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
:maxlength="30"
:invalid="Boolean(shownInvalidText)"
:invalidText="shownInvalidText"
autocomplete="username"
@blur="blurred = true"
@input="handleInput"
/>
Expand Down
Loading

0 comments on commit b5e679e

Please sign in to comment.